-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
78 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"title" : "Active Learning with 3Dmol.js" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|
||
|
||
|
||
|