Difference between revisions of "Sandbox"

From Jmol
Jump to navigation Jump to search
(Get the model from a different server)
(merging test with more code from Sandbox)
 
(14 intermediate revisions by the same user not shown)
Line 2: Line 2:
  
 
== Jmol extension for MediaWiki ==
 
== Jmol extension for MediaWiki ==
 +
{{Anchor|SampleAnchor}}
  
This uses <code>uploadedFileContents</code> tag with an XYZ file:
+
etc.
<jmol>
 
  <jmolApplet>
 
    <name>chair</name>
 
    <size>200</size>
 
    <uploadedFileContents>Chair.xyz</uploadedFileContents>
 
  </jmolApplet>
 
<jmolLink>
 
  <script>color atoms red</script>
 
  <text>color atoms red</text>
 
</jmolLink>
 
<jmolLink>
 
  <script>color atoms blue</script>
 
  <text>color atoms blue</text>
 
</jmolLink>
 
<jmolCheckbox>
 
  <scriptWhenChecked>color atoms lime</scriptWhenChecked>
 
  <scriptWhenUnchecked>color atoms cpk</scriptWhenUnchecked>
 
  <text>color atoms lime</text>
 
  <target>chair</target>
 
</jmolCheckbox>
 
  
<jmolButton>
+
etc.
  <script>color atoms blue</script>
 
  <text>color atoms blue</text>
 
</jmolButton>
 
  
</jmol>
 
For some reason, checkboxes are not working with the extension.
 
  
Color atoms:
+
== Anchors ==
<jmol>
 
<jmolMenu>
 
  <item>
 
  <script>color atoms cpk</script>
 
  <text>default</text>
 
  </item>
 
  <item>
 
  <script>color atoms yellow</script>
 
  <text>yellow</text>
 
  </item>
 
  <item>
 
  <script>color atoms blue</script>
 
  <text>blue</text>
 
  </item>
 
</jmolMenu>
 
</jmol>
 
  
 +
This is a test link to an [[#SampleAnchor|anchor]] which should take you near the top of the article.
  
This one uses the <code>inlineContents</code> tag, with straight MOL data on the left applet and with added pipe characters (|) on the right applet:
 
<table width="100%"><tr>
 
<td>
 
<jmol>
 
<jmolApplet>
 
<size>150</size>
 
<color>green</color>
 
<inlineContents>chair.mol
 
Conformational analysis
 
0
 
18 18  0  0  0                1 V2000
 
    1.6881    2.1572  -3.0193 C  0  0  0  0  0
 
    2.1484    3.6217  -2.9797 C  0  0  0  0  0
 
    2.9361    3.9126  -1.6942 C  0  0  0  0  0
 
    2.0927    3.5769  -0.4557 C  0  0  0  0  0
 
    1.6329    2.1120  -0.4898 C  0  0  0  0  0
 
    0.8532    1.8102  -1.7778 C  0  0  0  0  0
 
    2.5807    1.4887  -3.0652 H  0  0  0  0  0
 
    1.0897    1.9711  -3.9430 H  0  0  0  0  0
 
    1.2578    4.2927  -3.0282 H  0  0  0  0  0
 
    2.7791    3.8474  -3.8727 H  0  0  0  0  0
 
    3.8725    3.3053  -1.6844 H  0  0  0  0  0
 
    3.2413    4.9861  -1.6685 H  0  0  0  0  0
 
    1.2005    4.2467  -0.4224 H  0  0  0  0  0
 
    2.6835    3.7700    0.4714 H  0  0  0  0  0
 
    0.9957    1.8928    0.4002 H  0  0  0  0  0
 
    2.5240    1.4426  -0.4294 H  0  0  0  0  0
 
    0.5642    0.7322  -1.8031 H  0  0  0  0  0
 
  -0.0919    2.4039  -1.7878 H  0  0  0  0  0
 
  1  2  1  0  0  0
 
  1  6  1  1  0  0
 
  1  7  1  0  0  0
 
  1  8  1  6  0  0
 
  2  3  1  1  0  0
 
  2  9  1  0  0  0
 
  2 10  1  6  0  0
 
  3  4  1  1  0  0
 
  3 11  1  0  0  0
 
  3 12  1  0  0  0
 
  4  5  1  0  0  0
 
  4 13  1  0  0  0
 
  4 14  1  1  0  0
 
  5  6  1  6  0  0
 
  5 15  1  1  0  0
 
  5 16  1  0  0  0
 
  6 17  1  0  0  0
 
  6 18  1  0  0  0
 
M  END
 
</inlineContents>
 
  </jmolApplet>
 
</jmol>
 
</td>
 
<td>
 
<jmol>
 
<jmolApplet>
 
<size>150</size>
 
<color>green</color>
 
<inlineContents>|chair.mol                                         
 
|Conformational analysis                           
 
|0                                                 
 
| 18 18  0  0  0                1 V2000           
 
|    1.6881    2.1572  -3.0193 C  0  0  0  0  0 
 
|    2.1484    3.6217  -2.9797 C  0  0  0  0  0 
 
|    2.9361    3.9126  -1.6942 C  0  0  0  0  0 
 
|    2.0927    3.5769  -0.4557 C  0  0  0  0  0 
 
|    1.6329    2.1120  -0.4898 C  0  0  0  0  0 
 
|    0.8532    1.8102  -1.7778 C  0  0  0  0  0 
 
|    2.5807    1.4887  -3.0652 H  0  0  0  0  0 
 
|    1.0897    1.9711  -3.9430 H  0  0  0  0  0 
 
|    1.2578    4.2927  -3.0282 H  0  0  0  0  0 
 
|    2.7791    3.8474  -3.8727 H  0  0  0  0  0 
 
|    3.8725    3.3053  -1.6844 H  0  0  0  0  0 
 
|    3.2413    4.9861  -1.6685 H  0  0  0  0  0 
 
|    1.2005    4.2467  -0.4224 H  0  0  0  0  0 
 
|    2.6835    3.7700    0.4714 H  0  0  0  0  0 
 
|    0.9957    1.8928    0.4002 H  0  0  0  0  0 
 
|    2.5240    1.4426  -0.4294 H  0  0  0  0  0 
 
|    0.5642    0.7322  -1.8031 H  0  0  0  0  0 
 
|  -0.0919    2.4039  -1.7878 H  0  0  0  0  0 
 
|  1  2  1  0  0  0                               
 
|  1  6  1  1  0  0                               
 
|  1  7  1  0  0  0                               
 
|  1  8  1  6  0  0                               
 
|  2  3  1  1  0  0                               
 
|  2  9  1  0  0  0                               
 
|  2 10  1  6  0  0                               
 
|  3  4  1  1  0  0                               
 
|  3 11  1  0  0  0                               
 
|  3 12  1  0  0  0                               
 
|  4  5  1  0  0  0                               
 
|  4 13  1  0  0  0                               
 
|  4 14  1  1  0  0                               
 
|  5  6  1  6  0  0                               
 
|  5 15  1  1  0  0                               
 
|  5 16  1  0  0  0                               
 
|  6 17  1  0  0  0                               
 
|  6 18  1  0  0  0                               
 
|M  END                                           
 
</inlineContents>
 
  </jmolApplet>
 
</jmol>
 
</td>
 
</tr></table>
 
None of them work. This seems due to a defective parsing of newlines by the extension.
 
  
Let's test the same with inline PDB data:
 
<table width="100%"><tr>
 
<td>
 
<jmol>
 
<jmolApplet>
 
<size>150</size>
 
<inlineContents>
 
REMARK  Butane
 
HETATM    1  C  UNK    0      -0.769  0.000  0.000        C
 
HETATM    2  C  UNK    0      0.769  0.000  0.000        C
 
HETATM    3  C  UNK    0      -1.383  -0.728  1.203        C
 
HETATM    4  C  UNK    0      1.382  -0.741  1.196        C
 
HETATM    5  H  UNK    0      -1.127  1.059  0.007        H
 
HETATM    6  H  UNK    0      -1.142  -0.461  -0.945        H
 
HETATM    7  H  UNK    0      -1.001  -0.311  2.163        H
 
HETATM    8  H  UNK    0      1.128  -0.488  -0.940        H
 
HETATM    9  H  UNK    0      1.143  1.051  -0.017        H
 
HETATM  10  H  UNK    0      -2.493  -0.625  1.206        H
 
HETATM  11  H  UNK    0      -1.156  -1.818  1.183        H
 
HETATM  12  H  UNK    0      2.492  -0.792  1.105        H
 
HETATM  13  H  UNK    0      1.155  -0.230  2.158        H
 
HETATM  14  H  UNK    0      1.000  -1.787  1.259        H
 
END
 
</inlineContents>
 
  </jmolApplet>
 
</jmol>
 
</td>
 
<td>
 
<jmol>
 
<jmolApplet>
 
<size>150</size>
 
<inlineContents>
 
|REMARK  Butane                                                   
 
|HETATM    1  C  UNK    0      -0.769  0.000  0.000        C 
 
|HETATM    2  C  UNK    0      0.769  0.000  0.000        C 
 
|HETATM    3  C  UNK    0      -1.383  -0.728  1.203        C 
 
|HETATM    4  C  UNK    0      1.382  -0.741  1.196        C 
 
|HETATM    5  H  UNK    0      -1.127  1.059  0.007        H 
 
|HETATM    6  H  UNK    0      -1.142  -0.461  -0.945        H 
 
|HETATM    7  H  UNK    0      -1.001  -0.311  2.163        H 
 
|HETATM    8  H  UNK    0      1.128  -0.488  -0.940        H 
 
|HETATM    9  H  UNK    0      1.143  1.051  -0.017        H 
 
|HETATM  10  H  UNK    0      -2.493  -0.625  1.206        H 
 
|HETATM  11  H  UNK    0      -1.156  -1.818  1.183        H 
 
|HETATM  12  H  UNK    0      2.492  -0.792  1.105        H 
 
|HETATM  13  H  UNK    0      1.155  -0.230  2.158        H 
 
|HETATM  14  H  UNK    0      1.000  -1.787  1.259        H 
 
|END                                                               
 
</inlineContents>
 
  </jmolApplet>
 
</jmol>
 
</td>
 
</tr></table>
 
The right applet works. The difference with MOL format is likely because MOL requires the lines in a certain order, while PDB relies on the starting keyword.
 
I think that the extension is inserting extra newlines and quotes, that spoil the MOL parser but not the PDB parser. The newlines are ignored by Jmol.js, or replaced by pipes. Manually added pipes restore a proper start of line for the PDB parser.
 
--[[User:AngelHerraez|AngelHerraez]] 22:11, 30 November 2008 (CET)
 
  
  
Finally, if we insert the MOL data without any newlines and with pipes:
 
<jmol>
 
<jmolApplet>
 
<size>150</size>
 
<color>green</color>
 
<inlineContents>chair.mol|Conformational analysis|0| 18 18  0  0  0                1 V2000 |    1.6881    2.1572  -3.0193 C  0  0  0  0  0 |    2.1484    3.6217  -2.9797 C  0  0  0  0  0 |    2.9361    3.9126  -1.6942 C  0  0  0  0  0 |    2.0927    3.5769  -0.4557 C  0  0  0  0  0 |    1.6329    2.1120  -0.4898 C  0  0  0  0  0 |    0.8532    1.8102  -1.7778 C  0  0  0  0  0 |    2.5807    1.4887  -3.0652 H  0  0  0  0  0 |    1.0897    1.9711  -3.9430 H  0  0  0  0  0 |    1.2578    4.2927  -3.0282 H  0  0  0  0  0 |    2.7791    3.8474  -3.8727 H  0  0  0  0  0 |    3.8725    3.3053  -1.6844 H  0  0  0  0  0 |    3.2413    4.9861  -1.6685 H  0  0  0  0  0 |    1.2005    4.2467  -0.4224 H  0  0  0  0  0 |    2.6835    3.7700    0.4714 H  0  0  0  0  0 |    0.9957    1.8928    0.4002 H  0  0  0  0  0 |    2.5240    1.4426  -0.4294 H  0  0  0  0  0 |    0.5642    0.7322  -1.8031 H  0  0  0  0  0 |  -0.0919    2.4039  -1.7878 H  0  0  0  0  0 |  1  2  1  0  0  0 |  1  6  1  1  0  0 |  1  7  1  0  0  0 |  1  8  1  6  0  0 |  2  3  1  1  0  0 |  2  9  1  0  0  0 |  2 10  1  6  0  0 |  3  4  1  1  0  0 |  3 11  1  0  0  0 |  3 12  1  0  0  0 |  4  5  1  0  0  0 |  4 13  1  0  0  0 |  4 14  1  1  0  0 |  5  6  1  6  0  0 |  5 15  1  1  0  0 |  5 16  1  0  0  0 |  6 17  1  0  0  0 |  6 18  1  0  0  0 |M  END                                           
 
</inlineContents>
 
  </jmolApplet>
 
</jmol>
 
things work, so IT IS the newlines.
 
  
  
  
== Using a pop-up window ==
 
An image used for illustration and a caption for requesting the Jmol model:
 
  
{|name="userboxes" id="userboxes" style="margin-left: 1em; margin-bottom: 0.5em; width: 170px; border: {{{bordercolor|#99B3FF}}} solid 1px; background-color: {{{backgroundcolor|#FFFFFF}}}; {{{extra-css|}}}" align="right"
+
 
|-
+
 
|<center>[[Image:Ethane s.gif]]</center>
+
 
|-
+
 
| <center>'''Staggered ethane''' <br />
+
 
<jmol><jmolAppletLink><title>Show in 3D using Jmol (popup window)</title><color>gray</color>
+
 
<uploadedFileContents>ethane_s.pdb</uploadedFileContents></jmolAppletLink>
+
 
</jmol>
+
 
</center>
+
 
|-
+
 
|}
+
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
.

Latest revision as of 20:30, 23 November 2010

This is a page for testing.

Jmol extension for MediaWiki

etc.

etc.


Anchors

This is a test link to an anchor which should take you near the top of the article.















.

Contributors

AngelHerraez