Skip to main content
  • Poster presentation
  • Open access
  • Published:

Automated code generation from LEMS, the general purpose model specification language underpinning NeuroML2

Making models more transparent, reproducible and accessible is a major challenge in computational neuroscience. The wide range of modelling tools and strategies available, while convenient from a pragmatic point of view, often make model reuse harder. Efforts on standardization [1], model sharing [2, 3] and practices learned from the open-source community [35], on the other hand, are proving increasingly invaluable in improving the transparency and reusability of computational models. NeuroML2, the latest version of a model description language for computational neuroscience, is built on LEMS (Low Entropy Model Specification, [6]) a general purpose model specification language. LEMS has a highly structured, hierarchical format, rooted in physical principles, which allows the definition of physical systems including arbitrary networks of nodes modeled as hybrid dynamical systems. There are currently two LEMS interpreters, jLEMS [5] and PyLEMS [6], implemented in Java and Python respectively. As reference implementations, numerical performance and accuracy are not their primary goals. In order to simulate NeuroML2/LEMS models in an accurate, robust and efficient way it is important to be able to perform the numerical integration using well tested scientific simulators, both neuroscience specific, e.g. NEURON, and general purpose, e.g. XPPAUT, MATLAB. Such simulators provide a robust numerical infrastructure important for modelling in general, such as high-order ODE integration and accurate event detection.

We have developed a set of template-based code generators for LEMS whose goal is to transform a LEMS model into a number of representations compatible with different simulators, using back-end specific templates to produce native code. The translation of the models happens through an intermediate format, developed for this purpose, named dLEMS (distilled LEMS). The dLEMS abstraction is ODE centric for convenience of interoperability with the different target languages. It represents a flattened (e.g. hierarchical channel descriptions are reduced to the core ODEs) and dimensionless version of the LEMS model. The advantage of this approach, compared for instance to a compiler based strategy, is that users willing to provide support for a target simulator can more easily work with dLEMS, as it closely reflects the ODE representations used in general purpose simulators. Users will simply have to create new templates for their target simulator or modify existing ones. Our initial results show that the template-based code-generation approach is feasible, producing runnable simulations in a variety of platforms for single cell models – in particular, templates are available for the following platforms: C code generation (using the LLNL Sundials library for numerical integration), XPPAUT, MATLAB and Modelica. All tools we have developed for this are open source and freely available. We are presently working at extending the dLEMS specification of connections between elements, creating a simplified format for template based mapping to neuronal simulators.


  1. Gleeson P, Crook S, Cannon RC, Hines ML, Billings GO, Farinella M, Morse TM, Davison AP, Ray S, Bhalla US, Barnes SR, Dimitrova YD, Silver RA: NeuroML: A language for describing data driven models of neurons and networks with a high degree of biological detail. PLoS Computational Biology. 2010, 10 (1): e1003376-

    Google Scholar 

  2. ModelDB. []

  3. The Open Source Brain project. []

  4. Gewaltig MO, Cannon R: Current Practice in Software Development for Computational Neuroscience and How to Improve It. PLoS Comput Biol. 2014, 10 (1): e1003376- doi:10.1371/journal.pcbi.1003376

    Article  PubMed Central  PubMed  Google Scholar 

  5. Davison AP: Collaborative modelling: the future of computational neuroscience?. Network: Computation in Neural Systems. 2012, 23: 157-166.

    Google Scholar 

  6. LEMS: Low Entropy Model Specification. []

Download references


BM is supported by the Brazilian agency CAPES (2257-13/0). RAS, PG, RCC, MC were supported by the Wellcome Trust (086699). RAS is in receipt of a Wellcome Trust Principal Research Fellowship (095667) and an ERC Advanced Grant (ERC-AG-LS5).

Author information

Authors and Affiliations


Corresponding author

Correspondence to Boris Marin.

Rights and permissions

This article is published under license to BioMed Central Ltd. This is an Open Access article distributed under the terms of the Creative Commons Attribution License (, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. The Creative Commons Public Domain Dedication waiver ( applies to the data made available in this article, unless otherwise stated.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Marin, B., Gleeson, P., Cantarelli, M. et al. Automated code generation from LEMS, the general purpose model specification language underpinning NeuroML2. BMC Neurosci 15 (Suppl 1), P45 (2014).

Download citation

  • Published:

  • DOI: