Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-spherical particles in the structure viewer #275

Closed
rosecers opened this issue Apr 12, 2023 · 6 comments
Closed

Non-spherical particles in the structure viewer #275

rosecers opened this issue Apr 12, 2023 · 6 comments

Comments

@rosecers
Copy link
Collaborator

Putting this in here to bug my student @arthur-lin1027, along with a transcript between @Luthaf and myself.

[11:19 AM]
guillaume With 3Dmol, you could use https://3dmol.csb.pitt.edu/doc/GLShape.html#addCustom, manually constructing the ellipsoid shape
[11:20 AM] jsmol can do this natively, you could resurect the old renderer based on it and dynamically switch between 3Dmol and jsmol if the structure has ellipsoids to render
[11:20 AM] If you want to add this to chemiscope, could you open an issue to discuss changes to the data format to add required ellispoid information to the input?

@Luthaf I have done the thing

For the record, the data format changes are minimal, we can save the necessary information into the ase frame and add a function that changes that data (e.g. ellipsoid semi-axes and orientations) into isosurface data within the chemiscope backend. I would suggest a particle-type flag in the frame info/arrays that triggers an isosurface construction. Thoughts?

@Luthaf
Copy link
Contributor

Luthaf commented Apr 13, 2023

For the record, the data format changes are minimal, we can save the necessary information into the ase frame and add a function that changes that data (e.g. ellipsoid semi-axes and orientations) into isosurface data within the chemiscope backend. I would suggest a particle-type flag in the frame info/arrays that triggers an isosurface construction. Thoughts?

How does this look like in the chemiscope JSON format?

@Luthaf Luthaf changed the title Enable anisotropic viewing Non-spherical particles in the structure viewer Apr 13, 2023
@rosecers
Copy link
Collaborator Author

I think we could put in some particle-level list that defines {"semiaxes": {"target": "atom", "values": Nx3 matrix}, "orientations" {"target": "atom", "values": Nx4 quaternion list}}, and then write a chemiscope backend that converts this into the isosurface data type for 3dmol.

For the record, the data format changes are minimal, we can save the necessary information into the ase frame and add a function that changes that data (e.g. ellipsoid semi-axes and orientations) into isosurface data within the chemiscope backend. I would suggest a particle-type flag in the frame info/arrays that triggers an isosurface construction. Thoughts?

How does this look like in the chemiscope JSON format?

@Luthaf
Copy link
Contributor

Luthaf commented Apr 14, 2023

I would put the data inside the structures object instead of the properties. Something like

{"structures": [
    {
        "size": 42,
        "names": ["H", "O", "C", "C", ...],
        "x": [0, 1.5, 5.2, ...],
        "y": [5.7, 7, -2.4, ...],
        "z": [8.1, 2.9, -1.3, ...],
        "cell": [10, 0, 0, 0, 10, 0, 0, 0, 10],
        // new data
        "orientation": [[1, 2, 3, 2], [1, 1, 1, 0], [-2, 1, 0, 1], ...],
        "semiaxes": [[1, 2, 3], [1, 1, 1], [-2, 1, 0], ...]
    },
]}

This data also feels quite specific to ellipses, right? For other kinds of shapes, would we need the same data?

Something more explicit like below could also be nice

{"structures": [
    {
        "size": 42,
        "names": ["H", "O", "C", "C", ...],
        "x": [0, 1.5, 5.2, ...],
        "y": [5.7, 7, -2.4, ...],
        "z": [8.1, 2.9, -1.3, ...],
        "cell": [10, 0, 0, 0, 10, 0, 0, 0, 10],
        // new data
        "shapes": [
            {"kind": "ellipsoid", "orientation": [1, 2, 3, 2], "semiaxes": [1, 2, 3]},
            {"kind": "sphere"}, // this would be the default if not provided
            {"kind": "ellipsoid", "orientation": [1, 2, -1, 2], "semiaxes": [1, 2, 3]},
            {"kind": "ellipsoid", "orientation": [1, 0, 0, 2], "semiaxes": [1, 0, -1]},
            ...
        ]
    },
]}

this would enable other kinds of shapes, and multiple types of shapes in the same dataset.

@ceriottm
Copy link
Contributor

ceriottm commented Apr 14, 2023 via email

@rosecers
Copy link
Collaborator Author

rosecers commented May 8, 2023

Actively working on this, will let you know when we make progress...

@ceriottm
Copy link
Contributor

ceriottm commented Oct 5, 2023

I think we can now mark this as mission accomplished!

@ceriottm ceriottm closed this as completed Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants