SLiM 4.0 released

Skip to first unread message

Ben Haller

Aug 12, 2022, 8:08:34 PMAug 12
to slim-announce
Hi folks.  SLiM 4.0 has just been released.  This is a major release, and breaks backward compatibility and reproducibility for many models.  Given the magnitude of changes, some users may want to continue living on SLiM 3.7.1 for the time being; it is a stable release.  However, a handful of bugs in 3.7.1 have been fixed in SLiM 4, as discussed below; in general, upgrading is thus recommended.  This announcement will only touch on the highlights of what's new in SLiM 4; see the SLiM manual (chapter 29) for a more complete list, or the VERSIONS file for even more detail.


- To use SLiM 4 with tree-sequence recording, you should update to the current versions of related Python packages; recommended versions are at least 0.5.2 for tskit, 1.2.0 for msprime, and 1.0 for pyslim.  Version 1.0 of pyslim has just been released moments ago; huzzah!  There have been some changes to pyslim; for a guide to upgrading your Python code from previous versions, see

- SLiM's Eidos interfaces – the names of properties, methods, and classes – have changed significantly in 4.0.  If you open and run your scripts in the new SLiMgui, it should offer to "autofix" most of these changes for you, updating your scripts to 4.0.  Notably: in preparation for planned future work, fitness() callbacks are now called mutationEffect() callbacks, and fitness(NULL) callbacks are now called fitnessEffect() callbacks.  Along the same lines, early() is no longer the default event type; now there is no default, and early() must be explicitly declared in your script.  SLiMgui should autofix both of these changes for you.  For changes that are not autofixed, please see the manual for further information.

- Note that the macOS double-click installer no longer installs the manuals for you (matching the installers on other platforms).  The manuals should now be downloaded separately from


- The blockbuster new feature is that SLiM 4 supports simulating multiple species.  Each species can have its own genetic architecture, its own behaviors and life history, and can live on its own timescale.  You can easily simulate ecological interactions like predation, parasitism, mutualism, and competition, with either an individual-based or an aggregated approach.  In the SLiM manual, a new section 1.9 summarizes the concepts involved in multispecies modeling, and a new chapter 19 provides an in-depth look with eight new recipes; see those for further details on this exciting advance, which makes it easy to model eco-evolutionary and coevolutionary dynamics in SLiM.  Single-species models work much as they did before; this change is (almost) transparent for them.

- InteractionType has undergone a complete redesign under the hood to support spatial interactions between individuals of different species.  Most of these changes are transparent to the end user, although a few minor interface changes were made, and a few new methods were added; see chapter 29 for further details.  The big user-visible change is that for many models the memory usage due to InteractionType, which could be quite large for large models with a large maximum interaction distance, will be substantially reduced.

- A new killIndividuals() method allows nonWF models to simulate mortality at (almost) any time, such as when a predator eats a prey, or when a diease kills its host, without having to use fitnessScaling for this purpose.  Several recipes now illustrate the use this method and discuss its applications.

- A simulated species can now be a "no-genetics" species, with no chromosome and no mutations at all.  This avoids some annoying boilerplate genetics initialization, and slightly increases efficiency, when a species is only present for its ecological effects and does not evolve.

- To reduce order-dependency issues with callbacks, the order in which individuals are handled by callbacks can now be randomized.  This order randomization is enabled by default, but can be turned off with initializeSLiMOptions().

There are lots of more minor new features; see chapter 29 for a more complete list.


- Mutation frequencies/counts provided by the mutationFrequency() and mutationCount() methods could be incorrect in certain situations, expected to be rare; see for discussion.

- Tree-sequence metadata could be malformed in certain conditions after removal of a subpopulation.

- A crash could occur in removeMutations() if it was called on a null genome.

- Not exactly a "bug", but: calcFST() gave an "average of ratios"; it now gives a "ratio of averages", following best practice.

NEW/REVISED RECIPES: Many, perhaps most, of the recipes in the SLiM manual have been revised for this release, to bring them forward to SLiM 4's Eidos interfaces; most of these changes are trivial and were simply "autofixed" by SLiMgui.  A few recipes have also had bug fixes or improvements made, notably 18.14 and 18.15 (uniquing down mutations).  There are some new recipes: besides the new multispecies recipes in chapter 19, we now have recipe 14.15 (showing how to make a truly biallelic model in SLiM, primarily of interest for matching SLiM to biallelic analytical models), and a new second part to recipe 16.19 showing a second way to do a nonWF range expansion model (using a survival() callback).  If your own models are based upon SLiM recipes, it is strongly suggested that you check for changes in those recipes so that you benefit from the latest improvements and fixes.

INSTALLATION NOTES: If you are on Fedora, RedHat, CentOS, Arch, or the newly supported platforms openSUSE and SUSE Linux Enterprise, the SLiM installer for your Linux platform has already been updated (see chapter 2 of the SLiM manual for details).  If you are on Debian or Ubuntu, the installation strategy is being overhauled; we will announce when an installer for those platforms is available, but it may take a while (the installation instructions in the manual for those platforms will either not work, or give you version 3.7.1, I imagine); in the meantime Debian and Ubuntu users will need to build from sources, sorry (see chapter 2 for instructions).  If you are on macOS, download the double-click installer from the SLiM home page at  If you are on Windows, the pacman installer will be somewhat delayed (perhaps two weeks, at a guess); a followup post will be made here when it is ready, and in the meantime you can build from sources.  For those using conda, the new version is now available for all platforms (but does not give you SLiMgui, only slim).  Everyone else can download the source archive from the SLiM home page and build it themselves.  The manuals, recipes, and reference sheets have also undergone revisions, so you should re-download those too.  As noted at top, you must update to the latest pyslim, tskit, and msprime if you are using tree-sequence recording.

SLIM BEGINNERS: Note that a free SLiM Workshop is available online at, and is highly recommended for new users.  It has not yet been updated to SLiM 4; that should happen fairly soon.

If you have any questions, comments, etc., please use the slim-discuss group for that.  Thanks, and happy modeling!


Benjamin C. Haller
Messer Lab
Cornell University

Ben Haller

Aug 30, 2022, 9:43:02 AMAug 30
to slim-announce
Hi folks.  Just a quick announcement that, thanks to Russell Dinnage, the "pacman" installer for Windows is now updated and will install SLiM 4.0.  Thanks Russell!

In related news, the Debian/Ubuntu installer overhaul is proceeding apace and will probably be ready soon; it will be announced here when that happens.


Benjamin C. Haller
Messer Lab
Cornell University

Reply all
Reply to author
0 new messages