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

extend the color definition #7

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

nbehrnd
Copy link
Contributor

@nbehrnd nbehrnd commented Apr 24, 2023

The previously explicit color definition about carbon and hydrogen
was reorganized to host now all elements up and including Nd (i.e.,
element number 60) by a dictionary-like approach. Reference for
the scheme is the one deployed e.g., by Jmol. In case of an atom
typ still unknown to the program, there is an explicit note that
(and which) definition is missing. As in earlier versions, atom
types unkwown to the script are going to be processed as hydrogen.

Test-wise addition for / about nitrogen.  Tested on the example of
pyridine by openbabel from the SMILES string (`c1ccncc1`), and
diethylamine (`CCNCC`).
Tested for the examples of diethylether (`CCOCC`), THF (`C1COCC1`),
and propan-2-ol (`C(C)(O)(C)`) in .xyz files generated by obabel.
Tested with openbabel generated .xyz about diethyl thioether
(`CCSCC`) and furfural (`O=Cc1cccs1`).  However, contrasting to
e.g., the depiction with openbabel generated .pov, the C-S bonds
no longer are visible.
Tested with openbabel SMILES string of fluoroethane (`CCF`).  The
.pov/.ini and subsequent generation of .png seem fine.
Introduction of chlorine.  Tested with an .xyz about chloroethane
(`CCCl`) generated by openbabel, the chlorine atom is depicted as
sphere, separated from the backbone of the molecule.  Because of
a similar observation for compounds with C-S bonds, and because the
analogue CCF was rendered well, perhaps the assignment where to
draw a bond faces an obstacle here.
The previous approach requires four lines each for every atom type
as an instance of class Atom.  I think an approach which uses the
element symbol as key to a the corresponding values of mass,
radiosity, and rgb coordinates in a dictionary is - in comparison
to this one - easier to read, and to maintain.  Lacking any better
inspiration, atoms with atom types not yet explicitly defined in
said dictionary default to hydrogen.  In such an instance, the
conversion will not stop for good, however is going to issue one
warning for each atom not fully defined (yet).
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

Successfully merging this pull request may close these issues.

1 participant