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

SVG "ball-and-stick" depiction #193

Closed
ghutchis opened this issue Jun 17, 2015 · 9 comments
Closed

SVG "ball-and-stick" depiction #193

ghutchis opened this issue Jun 17, 2015 · 9 comments

Comments

@ghutchis
Copy link
Member

The current SVG code performs a 2D layout of a structure to produce a chemical diagram.

For some compounds, a better representation would be a ball-and-stick projection of the 3D coordinates, e.g.:
http://plindenbaum.blogspot.com/2009/06/fun-with-svg-ncbipubchemxslt-svg.html

@ghutchis
Copy link
Member Author

There is a bounty for adding this feature:
https://www.bountysource.com/issues/22362687-svg-ball-and-stick-depiction

@jnavila
Copy link
Contributor

jnavila commented Jul 18, 2015

Hi,

You are a developer of the project. What is the purpose of this bounty?

@ghutchis
Copy link
Member Author

I don't have time (or the expertise) to code this in a reasonable period of time. I would like the feature for a related project and I'm willing to offer the bounty. If you have the expertise, feel free to grab the bounty. :-)

@ghutchis
Copy link
Member Author

I'm willing to give pointers as well. I think my coding is better spent on the chemistry-oriented features rather than trying to figure out SVG..

@jnavila
Copy link
Contributor

jnavila commented Jul 18, 2015

OK. I have half a day to spend on this, and I just wanted to be sure that it would be of some use. Might be fun too...

@ghutchis
Copy link
Member Author

Some useful cases might be in:
src/xyzformat.cpp:WriteMolecule()
src/povrayformat.cpp

etab.GetRGB(int atomicnum)

If you have some time, I think it would be a great feature. I'm hoping to use it at http://pqr.pitt.edu/ for search results (i.e., rather than 20 interactive JavaScripts panels).

@jnavila
Copy link
Contributor

jnavila commented Jul 18, 2015

Do you think of any method to get a good idea of the radius of the circles depending on the atomic number ? Is there a "standard" on ball and stick representation ?

@ghutchis
Copy link
Member Author

# the most useful "bonding radius"
etab.GetCovalentRad(atomicnum);

# the "full" van der Waals radius
etab.GetVdwRad(atomicnum);

I think the "standard" would be the covalent radius, although some people scale the VdW radius down. I'd set that as a parameter and try a few scaling factors to see what looks the best.

@ghutchis
Copy link
Member Author

One other nice trick would be to find the best fit plane of the molecule given the XYZ coordinates and then project them via a "camera" perspective, e.g using Eigen:

    Eigen::Hyperplane<double, 3> planeCoeffs;
    Eigen::fitHyperplane(numAtoms(), atomPositions, &planeCoeffs);
    delete[] atomPositions;
    d->normalVector = planeCoeffs.normal();

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

2 participants