model_conversions.rst 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. *****************
  2. Model Conversions
  3. *****************
  4. Overview
  5. ########
  6. This section describes how to create an MCell4 model from
  7. an MDL or Data Model representations.
  8. MDL is a model definition language used by MCell3
  9. (`MDL Quick Reference Guide <https://mcell.org/documentation/MCellQuickReferenceGuide.pdf>`).
  10. Data Model is an internal JSON representation used primarily in CellBlender.
  11. When converting from MDL to MCell4 Python representation,
  12. The guide below expect that a system variable *MCELL_PATH* was set as described in
  13. MDL to Data Model
  14. #################
  15. The first step is to convert MDL representation to JSON Data Model.
  16. Navigate to the directory where your MDL files reside and run:
  17. .. code-block:: text
  18. $MCELL_PATH/mcell Scene.main.mdl -mdl2datamodel4
  19. MCell loads the MDL files, creates internal representation, and
  20. dumps it into a file called *data_model.json*.
  21. This representation can be then eeither converted to an MCell4 model as described in the
  22. following section or imported by CellBlender through
  23. **File** -> **Import** -> **CellBlender Model and Geometry (JSON)**.
  24. A drawback of this process is that all parameter names and
  25. their expressions will be lost because the source for the data model generation
  26. is an already processed model with all parameters evaluated.
  27. If the parameters and expressions are needed, it is necessary to correct
  28. the resulting model manually.
  29. Data Model to MCell4 Python Code
  30. ################################
  31. The next step, also used internally by CellBlender is to convert the data model into
  32. Python. The optional argument *-b* tell the converter all
  33. parameters, reactions and observables that can be defined with BNGL into a .bngl file.
  34. When not using the argument *-b*, only Python representation of the input model is created.
  35. .. code-block:: text
  36. $MCELL_PATH/bin/data_model_to_pymcell ../data_model.json -b
  37. This step creates several .py files with *model.py* being the main model file.
  38. Data Model to MDL Code
  39. ######################
  40. Models that do not use BNGL compartments and complex BNGL species (species that use components)
  41. can also be converted to the Model Description Language (MDL) that is the original model representation
  42. used by MCell3.
  43. .. code-block:: text
  44. python $MCELL_PATH/../../mdl/data_model_to_mdl.py data_model.json Scene.main.mdl
  45. This step creates several .mdl files with *Scene.main.mdl* being the main model file.