Difference between revisions of "Borrowed JSmol"

From Jmol
Jump to navigation Jump to search
(Borrowed JSmol)
(all links to other servers must be of the https form)
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
This page collects methods for displaying structures in JSmol on the web without actually having control of a web server.
 
This page collects methods for displaying structures in JSmol on the web without actually having control of a web server.
  
== Hosting JSmol pages in a cloud service ==
+
== JSmol displaying structures uploaded to a cloud service ==
...
+
There are 2 components in this approach:
 +
* where to locate the webpage that embeds the JSmol object (a common resource),
 +
* where to locate the file with the molecule or structure (your personal file)
  
== Display using JSmol of structures uploaded to a cloud service ==
+
:''An idea picked from'' [http://molecularmodelingbasics.blogspot.com.es/2015/11/quick-way-to-share-interactive.html Quick way to share interactive molecular structures and animations] by Jan Jensen (licensed under Creative Commons Attribution 4.0)
There are 2 parts here:  
 
* where the page that embeds the JSmol object is located (a common resource),
 
* where the file with the molecule or structure is located (your personal file)
 
 
 
''An idea picked from''
 
[http://molecularmodelingbasics.blogspot.com.es/2015/11/quick-way-to-share-interactive.html Quick way to share interactive molecular structures and animations] by Jan Jensen (licensed under Creative Commons Attribution 4.0)
 
  
 
=== JSmol display ===
 
=== JSmol display ===
Display of the molecular structure in a JSmol panel is achieved via this page:
+
Display of the molecular structure in a JSmol panel is achieved via this page provided by Bob Hanson:
 
  {{StOlaf}}jmol.php
 
  {{StOlaf}}jmol.php
with a special syntax in the URL: you must append the <code>?source=</code> token followed by the url of your molecular file (see examples below).
+
with a special syntax in the URL, i.e. you must append the <code>?source=</code> token followed by the url of your molecular file (see examples below, or more details at [[Jmol PHP]]).
  
 
The URL may easily be copied and shared by email, Tweet, blog or any other means to whoever you want to show your molecular model to. Since all data are in public servers and the page uses JSmol/html5, it is most likely that ayone can view it on any platform, without installing or learning any software.
 
The URL may easily be copied and shared by email, Tweet, blog or any other means to whoever you want to show your molecular model to. Since all data are in public servers and the page uses JSmol/html5, it is most likely that ayone can view it on any platform, without installing or learning any software.
Line 30: Line 26:
 
|-
 
|-
 
! url for JSmol display
 
! url for JSmol display
| {{StOlaf}}jmol.php?source=http://files.figshare.com/1860026/ethen_01oIRC.cml
+
| {{StOlaf}}jmol.php?source=https://files.figshare.com/1860026/ethen_01oIRC.cml
 
|}
 
|}
  
''(Thanks to @janhjensen for the tip)''
+
Note that both URLs must be secure, so they must include the 's' in http<span style="color:red">s</span>.
 +
:''(Thanks to @janhjensen for the tip)''
  
 
=== DropBox ===
 
=== DropBox ===
Once your molecular file has been uploaded to Dropbox, you need a trick:
+
Once your molecular file has been uploaded to Dropbox, you need to trick the regular link, of the form
  
Change the regular link, of the form
+
<code><nowiki>http://www.dropbox.com/s/xxx/file?dl=0</nowiki></code>
  
<code>http<span style="color:red">s</span>://www.dropbox.com/s/xxx/file?dl=0</code>
+
changing it to this form:
  
to this form:
+
<code>http<span style="color:red">s</span>://dl.dropboxusercontent.com/s/xxx/file</code>
 
 
<code><nowiki>http://dl.dropboxusercontent.com/s/xxx/file</nowiki></code>
 
  
 
and then append it to the JSmol url:
 
and then append it to the JSmol url:
Line 51: Line 46:
 
|-
 
|-
 
! link to file
 
! link to file
| https://www.dropbox.com/s/t42dx22mxsioja6/ethen_test.xyz?dl=0
+
| http://www.dropbox.com/s/t42dx22mxsioja6/ethen_test.xyz?dl=0
 
|-
 
|-
 
! url for JSmol display
 
! url for JSmol display
| {{StOlaf}}jmol.php?source=http://dl.dropboxusercontent.com/s/t42dx22mxsioja6/ethen_test.xyz
+
| {{StOlaf}}jmol.php?source=https://dl.dropboxusercontent.com/s/t42dx22mxsioja6/ethen_test.xyz
 
|}
 
|}
  
''(Thanks to @janhjensen and @aminophen for the tip)''
+
Note that both URLs must be secure, so they must include the 's' in http<span style="color:red">s</span>.
 +
:''(Thanks to @janhjensen and @aminophen for the tip)''
  
 
=== Other servers ===
 
=== Other servers ===
It may also be possible to use any other web server, as long as you can grab a permanent url that directly points to your file.
+
It may also be possible to use any other web or file server, as long as you can grab a permanent url that directly points to your file. In case of limitations from the server policies, remember that J(S)mol does not care about the file extension, i.e. you can change it, except when it is a binary file, then a [[Jmol_JavaScript_Object#Reading_binary_files|known binary extension]] must be included.
 +
 
 +
=== Custom displays via script ===
 +
The idea is to link to a JmolScript file rather than to the molecular file. In this way, you provide a personalized view and rendering, activate spin or vibration or animation,... without any further instructions for your target colleague to operate JSmol.
 +
 
 +
Remember that the script file must contain a load command that points to the url of the molecular file.
 +
 
 +
Another possible solution is to save a PNG+JMOL file, upload it and then serve that to the StOlaf jmol.php page. That should preserve the whole state of the model.
 +
 
 +
== JSmol pages hosted in a cloud service ==
 +
Some people have succeeded in uploading all JSmol files + the webpage files to a cloud server like dropbox, in their personal area, and provide a public url link where the pages load with JSmol and models included.
 +
More details will be provided here in due time.
  
=== Custom displays via script ==
+
''...pending...''
...
 

Latest revision as of 10:09, 9 January 2017

This page collects methods for displaying structures in JSmol on the web without actually having control of a web server.

JSmol displaying structures uploaded to a cloud service

There are 2 components in this approach:

  • where to locate the webpage that embeds the JSmol object (a common resource),
  • where to locate the file with the molecule or structure (your personal file)
An idea picked from Quick way to share interactive molecular structures and animations by Jan Jensen (licensed under Creative Commons Attribution 4.0)

JSmol display

Display of the molecular structure in a JSmol panel is achieved via this page provided by Bob Hanson:

https://chemapps.stolaf.edu/jmol/jmol.php

with a special syntax in the URL, i.e. you must append the ?source= token followed by the url of your molecular file (see examples below, or more details at Jmol PHP).

The URL may easily be copied and shared by email, Tweet, blog or any other means to whoever you want to show your molecular model to. Since all data are in public servers and the page uses JSmol/html5, it is most likely that ayone can view it on any platform, without installing or learning any software.

If you want to share a customized view of your molecule (not just the default ball & stick rendering), the way to follow is to write a small script file that will load the molecule and then apply any Jmol scripting. Then your link should use the url of that script file rather than the molecular file. See details below.

FigShare

Once your molecular file has been uploaded to figshare, copy the link to it (it may be in any file format that Jmol accepts, like the most common pdb and mol formats). For example:

link to file http://files.figshare.com/1860026/ethen_01oIRC.cml
url for JSmol display https://chemapps.stolaf.edu/jmol/jmol.php?source=https://files.figshare.com/1860026/ethen_01oIRC.cml

Note that both URLs must be secure, so they must include the 's' in https.

(Thanks to @janhjensen for the tip)

DropBox

Once your molecular file has been uploaded to Dropbox, you need to trick the regular link, of the form

http://www.dropbox.com/s/xxx/file?dl=0

changing it to this form:

https://dl.dropboxusercontent.com/s/xxx/file

and then append it to the JSmol url:

link to file http://www.dropbox.com/s/t42dx22mxsioja6/ethen_test.xyz?dl=0
url for JSmol display https://chemapps.stolaf.edu/jmol/jmol.php?source=https://dl.dropboxusercontent.com/s/t42dx22mxsioja6/ethen_test.xyz

Note that both URLs must be secure, so they must include the 's' in https.

(Thanks to @janhjensen and @aminophen for the tip)

Other servers

It may also be possible to use any other web or file server, as long as you can grab a permanent url that directly points to your file. In case of limitations from the server policies, remember that J(S)mol does not care about the file extension, i.e. you can change it, except when it is a binary file, then a known binary extension must be included.

Custom displays via script

The idea is to link to a JmolScript file rather than to the molecular file. In this way, you provide a personalized view and rendering, activate spin or vibration or animation,... without any further instructions for your target colleague to operate JSmol.

Remember that the script file must contain a load command that points to the url of the molecular file.

Another possible solution is to save a PNG+JMOL file, upload it and then serve that to the StOlaf jmol.php page. That should preserve the whole state of the model.

JSmol pages hosted in a cloud service

Some people have succeeded in uploading all JSmol files + the webpage files to a cloud server like dropbox, in their personal area, and provide a public url link where the pages load with JSmol and models included. More details will be provided here in due time.

...pending...

Contributors

AngelHerraez