Closed mkhorton closed 7 years ago
As a follow-up, these CHGCAR files can be very large (10s-100s MB) and not suitable for providing directly online. If 3Dmol can derive an isosurface, is there a way to serialize this isosurface, so that we can do the generation once and then supply the user with the derived isosurface instead of the CGHCAR, to save time loading/processing?
You can call addUnitCell to draw the unit cell bounding box, but this currently only works with pdb and mmcif file formats. We could certainly add support for other file formats if they have the required information.
Can you give examples of axes compass and co-ordination polyhedra?
You can use addMesh to provide pre-rendered isosurfaces.
Sure,
Axes compass: this is simply three arrows showing the direction of a, b and c lattice vectors defining the unit cell bounding box, e.g. see the arrows in this image
Co-ordination polyhedra: instead of a ball+stick atoms+bonds representation, it's common to draw spheres for atoms, and then join all the atoms an atom is bonded to together to form a polyhedron, example: https://www.materialsproject.org/materials/mp-12992/ This is a very common approach used by e.g. JMol, Vesta, CrystalMaker etc. to visualize crystallographic structures.
You can use addMesh to provide pre-rendered isosurfaces.
Thanks, will look into this. As an outline, would this be using VolumeData
to load the CHGCAR, GLShape.add_isosurface()
to generate the isosurface, and then extract/serialize this mesh somehow, and later re-load it with GLViewer.addMesh()
?
You can call addUnitCell to draw the unit cell bounding box, but this currently only works with pdb and mmcif file formats. We could certainly add support for other file formats if they have the required information.
It looks like you're already parsing the relevant lattice vectors for VASP (POSCAR/CONTCAR) files:
https://github.com/3dmol/3Dmol.js/blob/master/3Dmol/parsers.js#L402
This should directly give the matrix that addUnitCell uses for it to work with VASP files.
My previous implementation for addUnitCell didn't work, I think I tracked it down to the line modelData.cryst = {'matrix':matrix}
. I'm not sure what was wrong with that, but it caused an exception here with modelData.symmetries
being undefined? This has now been fixed, but it's unclear to me why it didn't work previously.
Regarding my other questions (axes compass, co-ordination polyhedra, serializing isosurface meshes), is it okay if I create separate issues for these? I think I can probably implement the axes compass myself and submit a PR for that, but it might be easier to discuss these if they were separate issues.
Yes, separate issues please. A contribution for co-ordination polyhedra would be especially welcome since I'm not familiar with them (the axes would be a fairly simple convenience function that draws three arrows)
Hello,
I hope this is an appropriate place to ask.
I can see that 3Dmol's volume class has a 'vasp' option, and there are some references to POSCAR files in the code too, but I can't find documentation for this anywhere. Does 3Dmol.js support visualization of VASP POSCAR/CHGCAR files? (Edit: I've now found the vasp_test.html file in your source, so will try this out!)
More generally, how robust is 3Dmol.js' support for crystallographic data generally? i.e. is it possible to draw the unit cell bounding box, axes compass, or co-ordination polyhedra (if bonds have been detected)?
Thank you kindly for your time!