Use own json-Files in MW nextgen

24 views
Skip to first unread message

morti...@googlemail.com

unread,
Apr 27, 2016, 9:42:27 AM4/27/16
to lab-models
Hello,

I'm not sure if I'm here in the right place, but I couldn't find an answer somewhere else, so I try it here.
Is there a possibility to embed the MW nextgen on a website and load own json files for the model and the interactive editor?
Thanks for your answer in advande.

Best Janneck

Daniel Damelin

unread,
Apr 27, 2016, 10:35:15 AM4/27/16
to lab-m...@googlegroups.com
Hi Janneck,

There are a couple of ways to do that, both of which involve creating your own new models and interactive definitions (inputs, outputs, and layout). You could either clone our github repo and serve it yourself, and/or you can issue pull requests to add your new models back to the community database where we will serve them. Unfortunately we don’t have any formal documentation. However, here is some detailed info about authoring interactives that should help.

The codebases are managed as Git repositories on Github. The codebase in which you will do most, if not all, of your work is the lab-interactives-site. This is where all the interactive definitions and model definitions are stored. To do work here, you should fork the repo and follow the directions in the Readme file (shown on the landing page of the repo) to set up a local clone of your fork of the repository, and then create a branch for doing work on a particular interactive. Once you have work you want to share you can submit a pull request for that branch and we can take a look at it to make sure it is running properly and the format is compliant with how we format other interactive files (mainly how things are indented and where line breaks are used). You can look at many other examples at the lab-interactives-site to see what is expected. Of course you can run your own branch of the code in which case you don’t need to pass anything by us, but if you would like to contribute back to the community we’d love to see what you are working on.

The Lab framework is another repository. This contains the code for the molecular dynamics engine (as well as some other modeling engines) and has the code for rendering the view of the models and the surrounding interactives. If you wanted to create new modeling features, user interface widgets, or outputs, this is where those kinds of changes would be made, but this codebase is more complex than making new interactives using current features. There are a few parts of this repo that will be helpful to be familiar with even if you are not modifying it.

Generally you will look at other interactives for examples of how to do things you want to do, but there are some formal definitions of the interactive and model JSON files. These will give you some sense of the parts that are possible to be present, and in some cases what they refer to. See:

Sometimes it is not clear what properties are allowable (or required) when authoring an interactive. This should be a comprehensive list. The comments in the code can also sometimes help you understand what the properties relate to.

The models have their own JSON definition. This file shows what properties are associated with the molecular dynamics models. Mostly you will not be hand coding these model JSON files. Instead you will likely create and modify them using the original Java-based version of our modeling tool—the Molecular Workbench. See below how we convert this to the model JSON format to use in the HTML5-based interactives you will make.

In the Interactive you will often want to write JavaScript that talks to the model via an API. The scripting API for the molecular dynamics model is here:

We still generally create models (the initial number, position, and properties of atoms) using the Classic (Java) version of the Molecular Workbench. When you save a page you made using that application, the saved model files all have the .mml extension. This type of file can be converted to the new .json format by using the converter found here: http://lab-framework.concord.org/mml-converter.html  

Hope that is enough to get you started,
-Dan

--
You received this message because you are subscribed to the Google Groups "lab-models" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lab-models+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

morti...@googlemail.com

unread,
May 9, 2016, 11:37:24 AM5/9/16
to lab-models
Hey Dan!
Thank you very much for your short and clear introduction! Now I've got the right starting points.

Reply all
Reply to author
Forward
0 new messages