3dmol / 3Dmol.js

WebGL accelerated JavaScript molecular graphics library
https://3dmol.org/
Other
803 stars 194 forks source link

Different display with Mol2 and SDF #37

Closed ghutchis closed 9 years ago

ghutchis commented 9 years ago

When we use 3DMol for the same file in either Mol2 or SDF format, we see two very different geometries. Also, with Mol2 files, hydrogens aren't shown, but they are with SDF. https://gist.github.com/ghutchis/4243c0242423770d58a3

1) Is it possible to make showing explicit hydrogens a setting (i.e., so it can be the default for us even with Mol2 files)? 2) Why is the geometry so different with Mol2 - the Cartesian coordinates are the same and Open Babel generates the same InChI as far as I can tell..

RitwikGupta commented 9 years ago

The code is we use is:

<div class='viewer_3Dmoljs' data-href='/static/data/FILE.mol2' data-type='mol2' data-backgroundcolor='0xffffff' data-style='stick'></div>

and

<div class='viewer_3Dmoljs' data-href='/static/data/FILE.sdf' data-type='sdf' data-backgroundcolor='0xffffff' data-style='stick'></div>
dkoes commented 9 years ago

I can't reproduce this. Are you using the latest and greatest 3Dmol.js?

Showing hydrogens is the default for everything but pdb files (cause I don't like it for pdb files). Hiding hydrogens wasn't working for sdf and mol2s though I just committed a fix.

RitwikGupta commented 9 years ago

We're using the No-jQuery verison of 3dMol, because it's conflicting with jQuery if we import it ourselves separately.

RitwikGupta commented 9 years ago

Testing it with the latest build of 3Dmol.js from http://3dmol.csb.pitt.edu/build/3Dmol.js fixes the issue, but it breaks jQuery otherwise due to namespace conflicts.

dkoes commented 9 years ago

Why not use the nojquery version? Are you saying that the most recent nojquery version doesn't work but the jquery included one does?

JoshuaRogan commented 9 years ago

Switching from the CDN noquery version the hydrogens show.

RitwikGupta commented 9 years ago

That fixed it! We changed from

<script src="http://cdn.jsdelivr.net/3dmol.js/latest/3Dmol-nojquery-min.js"></script>

to

<script src="http://3Dmol.csb.pitt.edu/build/3Dmol-nojquery.js"></script>

for our CDN and that fixed everything.

dkoes commented 9 years ago

Linking to 3dmol.csb.pitt.edu gives the the very latest version. The jsdeliver version is only updated when I tag a release. My recommendation would be to link to the 3dmol version for now as you develop the site. That way if there are any bug fixes or features you need you can pick them up right away. Once your site is in a happy place, I can tag a release, and you can switch to the more stable jsdeliver, CDN hosted version.