On Dec 11, 5:22 pm, Boyang <
boyang....@gmail.com> wrote:
> Hi Rich,
>
> 1) I wonder whether geometric data could implemented. For example,
> bond and torsion angle. The function Bond.getStereo() seems to be a
> tentative implementation, but I think, right now it only returns the
> value you input when creating a new bond through Molecule.connect().
Hello Boyang, thanks for the comments.
Interesting idea. What kind of geometric data would you want to use?
Bond.getStereo follows the conventions for bond stereo set out in the
V2000 molfile spec from MDL. The similarity was planned - MX should
read and write molfiles quickly.
I'm open to other ideas, though.
> 2) What about error corrections? See the following code. As far as I
> understand, I just made something like a cyclohexene with a double
> bond from the first and a triple bond from the second C to an C, which
> is a bit weird.
>
> Molecule alkane = Molecules.createHexane();
> alkane.addAtom("C");
> alkane.connect(alkane.getAtom(5), alkane.getAtom(6), 3, 4);
> alkane.connect(alkane.getAtom(0), alkane.getAtom(6), 2);
> alkane.connect(alkane.getAtom(0), alkane.getAtom(2), 2);
> System.out.println(alkane.countAtoms());
> System.out.println(alkane.countBonds());
> System.out.println(alkane.getBond(5).getStereo());
> System.out.println(alkane.getAtom(6).getValence());
Error checking (in the form of throwing runtime exceptions, for
example) for valence errors was not part of the original MX design.
One reason was that MX was factored out of ChemWriter, a 2-D structure
editor in which a user may need to make hypervalent atoms on the way
toward drawing their target structure.
Another reason was to enable MX to load molfiles as quickly as
possible. It's assumed that the molfile was encoded properly.
It would not be hard to implement a separate valency checker, though.
> 3) Why does Atom.getValence() return 5 for a triple bond?
Hmm, not sure I follow. Are you referring to question (2) above? If
so, the valence calculator won't work because the molecule has broken
too many valency rules.
For example, from JRuby:
import com.metamolecular.mx.model.DefaultMolecule
m=DefaultMolecule.new
a0=m.add_atom "C"
a1=m.add_atom "C"
m.connect(a0, a1, 3) # at this point, acetylene
a0.getValence # => 3