"url={URL}" - Load Molecule from URL

Q

How to load a molecule structure with a given URL in the Online 3Dmol Viewer?

✍: FYIcenter.com

A

You can use the url={URL} URL parameter to load a molecule structure from a given URL in the Online 3Dmol Viewer.

https://3dmol.org/viewer.html?url={URL}&type={Type}

The type={Type} parameter is needed to specify the loaded data format.

For example, the following URL will load a benzene molecule structure in SDF format:

https://3Dmol.org/viewer.html?url=https://3dmol.org/tests/test_structs/benzene.sdf&type=sdf

For example, the following URL will load a benzene molecule structure in SDF format:

https://3Dmol.org/viewer.html?url=https://3dmol.org/tests/test_structs/benzene.sdf&type=sdf

The following URL will load a protein structure in PDB format:

https://3Dmol.org/viewer.html?url=http://files.rcsb.org/view/1YCR.pdb&type=pdb&style=cartoon
Online 3Dmol Viewer - Load Molecule with URL
Online 3Dmol Viewer - Load Molecule with URL

Note that if the URL to load the molecule structure data contains multiple URL parameters, 3Dmol viewer will not be able to support. For example, the following URL will download the SDF data structure of a compound from PubChem API:

https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/2244/SDF?record_type=3d&version=1.1

If you invoke the 3Dmol viewer with the above URL

https://3dmol.org/viewer.html?url=https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/2244/SDF?record_type=3d&version=1.1

You will see a blank screen and the following error in browser's developer console. Because the "version=1.1" is being processed as a parameter for viwer.html, not for PubChem API:

Uncaught Illegal url string : version

 

UI Components of Online 3Dmol Viewer

"cid={PubChem_CID}" - Load Molecule from PubMed

Using Online Server of 3Dmol Viewer

⇑⇑ 3Dmol.js FAQ

2023-09-07, 381🔥, 0💬