Collections:
Install 3Dmol.js Library Locally
How to install the 3Dmol.js library locally on my own Web server?
✍: FYIcenter.com
If you want use a local copy of the 3Dmol.js library,
you can follow these steps.
1. Download a copy of the 3Dmol.js library:
fyicenter$ curl https://3Dmol.csb.pitt.edu/build/3Dmol-min.js > 3Dmol-min.js
2. Create an HTML file, Draw-Box.html, with the following code:
<html><head>
<script src="/3Dmol-min.js"></script>
<style>
.mol-container {width: 400px; height: 400px; position: relative;}
</style>
</head>
<body>
<div id="container-01" class="mol-container"></div>
<script>
$(function() {
let element = $('#container-01');
let config = { backgroundColor: 'grey' };
let viewer = $3Dmol.createViewer( element, config );
viewer.addBox({center:{x:0,y:0,z:0},dimensions: {w:3,h:4,d:2},color:'magenta'});
viewer.zoomTo();
viewer.rotate(45, {x:1,y:1,z:1});
viewer.render();
});
</script>
</body></html>
3. Copy the library and the HTML document to your Web server document directory:
fyicenter$ cp 3Dmol-min.js /var/www/html fyicenter$ cp Draw-Box.html /var/www/html
4. View the HTML document through your Web server: http://localhost/Draw-Box.html. You see a nice 3D box. You can room in and rotate it with your mouse.
Note that if you load the HTML file directly without using any Web Server, you may get the "Not allowed to load local resource" error for loading the 3Dmol.js file. You can disable the security control in the browser's setting to avoid this error.
⇒ Display 3-D Molecule Structure with 3Dmol.js
⇐ Use the Online Version of 3Dmol.js Library
⇑ Getting Started with 3Dmol.js
⇑⇑ 3Dmol.js FAQ
2022-12-24, 1337🔥, 0💬
Popular Posts:
Molecule Summary: ID: FYI-1006582 Names: InChIKey: KREJOXYCRKVVIR-UHFFFAOYS A-NSMILES: CCN(CC)CCCCC(...
Molecule Summary: ID: FYI-1000205 SMILES: CCC(C)C1=C(C(=CC(=C1)C(C )(C)C)N2N=C3C=CC=CC3=N2) OReceived...
Molecule Summary: ID: FYI-1000310 SMILES: Cn1ccnc(c1=O)NC(=O)[C@@H ]2CC(=O)N(C2)CCc3ccccc3Received a...
Molecule Summary: ID: FYI-1006572 Names: InChIKey: UITJTVRLBSRZPI-UHFFFAOYS A-NSMILES: CC(=O)c1cc(NC...
Molecule Summary: ID: FYI-1001132 SMILES: C1=CC2=C(C3=C(C=CC=N3)C= C2)N=C1Received at FYIcenter.com ...