Skip to content

Commit

Permalink
Learning environ documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
dkoes committed Jul 7, 2020
1 parent d00f4b0 commit b9f693a
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 5 deletions.
17 changes: 13 additions & 4 deletions css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ a:hover{
}

.titlefont {
font-size: 24px;
font-size: 22px;
font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
font-weight: 100;

Expand All @@ -150,6 +150,7 @@ a:hover{
}

#infotext {
font-size: 12px;
margin-top: 8px;
font-style:oblique;
float:left;
Expand Down Expand Up @@ -179,16 +180,24 @@ a:hover{
}

#view {
width: 3em;
width: 2.5em;
}


#embed {
width: 4em;
width: 3.5em;
}

#develop {
width: 5em;
width: 4.5em;
}

#teach {
width: 3em;
}

#jupyter {
width: 3.75em;
}

#issues {
Expand Down
16 changes: 15 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
$("#text3Dmol").hide();
$("#viewtext").hide();
$("#embedtext").hide();
$("#teachtext").hide();
$("#jupytertext").hide();
$("#developtext").hide();
};
Expand All @@ -97,6 +98,17 @@
hidetext();
$("#text3Dmol").show();
});

$('#teach').hover(
function () {
hidetext();
$("#teachtext").show();
},
function () {
hidetext();
$("#text3Dmol").show();
});

$('#jupyter').hover(
function () {
hidetext();
Expand Down Expand Up @@ -128,13 +140,15 @@
<div id="strip" class = "titlefont">
<a href="doc/tutorial-url.html" id="view" class="titletext">View</a>
<a href="doc/tutorial-embeddable.html" id="embed" class="titletext">Embed</a>
<a href="http://nbviewer.jupyter.org/github/3dmol/3Dmol.js/blob/9050b97144e81f065df7eecc87ba9a16723ab14b/py3Dmol/examples.ipynb" id="jupyter" class="titletext">Jupyter&nbsp;&nbsp</a>
<a href="doc/tutorial-learning_environment.html" id="teach" class="titletext">Teach</a>
<a href="http://nbviewer.jupyter.org/github/3dmol/3Dmol.js/blob/9050b97144e81f065df7eecc87ba9a16723ab14b/py3Dmol/examples.ipynb" id="jupyter" class="titletext">Jupyter</a>
<a href="doc/index.html" id="develop" class="titletext">Develop</a>
</div>
<div id="infotext">
<span id="text3Dmol" class="floattext">A modern, object-oriented JavaScript library for visualizing molecular data</span>
<span id="viewtext" class="floattext">View structures through a declarative URL interface</span>
<span id="embedtext" class="floattext">Embed molecular viewers in webpages with two lines of code</span>
<span id="teachtext" class="floattext">Engage students while teaching molecular structures</span>
<span id="jupytertext" class="floattext">Include interactive 3D structures in Jupyter notebooks</span>
<span id="developtext" class="floattext">Develop web applications using a full featured API</span>

Expand Down
3 changes: 3 additions & 0 deletions tutorials/learning_environment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"title" : "Active Learning with 3Dmol.js"
}
47 changes: 47 additions & 0 deletions tutorials/learning_environment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<script src="../build/3Dmol-min.js"></script>

The [hosted 3Dmol.js viewer](tutorial-url.html) can serve as an active learning environment of engaging and querying students when teaching properties of 3D molecular structures. The instructor creates a session using the share button in the upper right corner. When students connect to this session, they see the same molecular view as the instructor. Although the students can independently manipulate the view, the instructor can override their view.

The instructor can pose questions that the students then answer by clicking on atoms. The accumulated and anonymous answers can then be displayed in the instructor's view.

<iframe width="560" height="315" src="https://www.youtube.com/embed/90UhGlzLcdc" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

## Self-Hosting

The easiest way to use the 3Dmol.js active learning environment is through the hosted viewer at [https://3dmol.csb.pitt.edu]. However, it may be desirable to host your own instance for your class. A light-weight Flask webserver can quickly be brought up on a Ubuntu Linux machine with a few commands:


```
{@lang bash}#install dependencies
apt install npm python3-pip
pip3 install flask flask_socketio eventlet
#use npm to install and build 3Dmol.js
npm install 3dmol
#run a standalone flask server
cd node_modules/3dmol/learning-environment
#can optionally specify a port with -p <PORT>, default is 5000
python3 server.py
```

By default, this will launch a server on port 5000, e.g. <tt>http://HOSTNAME:5000/</tt>. Do <b>not</b> run this command as superuser to run the server on the privileged default webserver port 80 without consulting with a network security specialist.


If you already have a webserver running, you can redirect the websocket requests used by 3Dmol.js to the server running on port 5000. For example, for apache the following is added to the configuration (see [here](https://stackoverflow.com/questions/36472920/apache-proxy-configuration-for-socket-io-project-not-in-root)</a>):


<pre>
<font color='black'>RewriteEngine On
RewriteCond %{REQUEST_URI} ^/socket.io [NC]
RewriteCond %{QUERY_STRING} transport=websocket [NC]
RewriteRule /(.*) ws://localhost:5000/$1 [P,L]

ProxyPass /socket.io http://localhost:5000/socket.io
ProxyPassReverse /socket.io http://localhost:5000/socket.io
<font>
</pre>

The [flask-SocketIO documentation](https://flask-socketio.readthedocs.io/en/latest/) provides more information for running in other setups such as gunicorn, uwsgi, and nginx.




0 comments on commit b9f693a

Please sign in to comment.