#199 AtomPlacer cannot deal with placing a third atom


The AtomPlacer has problems when adding a third
carbon to the center carbon of a propane (CCC)
molecule. The problem is around line 203 where the
'occupied direction' is calculated. In case of linear
molecules with equals bond lengths, this vector has a
zero length, and the AtomPlacer cannot determine a
good angle then.


  • Christoph Steinbeck

    Logged In: YES

    I suggest a three step process:

    1. The procedure currently implements (place the new
      substituent away from the geometric center of the bonding
      If the resulting vector is zero or too small:

    2. Do the same based on the geometric center of all atoms in
      a molecule (won't help you with you current CCC problem, but
      will help in some strange other cases).
      If resulting vector is too small or zero:

    3. take an arbitrary, already placed partner of the center
      atom and use it's coordinated to generate the newDirection
      vector (it will then point into the direction of the
      respective, already placed atom) and rotate it by 90 degrees.

    double angle = GeometryTools.getAngle(partnerAtom.getX2D() -
    atom.getX2D(), partnerAtom.getY2D() - atom.getY2D());

    double addAngle = Math.toRadians(90);

    angle += addAngle;
    Vector2d vec1 = new Vector2d(Math.cos(angle), Math.sin(angle));
    Point2d point1 = new Point2d(atom.getPoint2D());

    or so :-)

  • Egon Willighagen

    Logged In: YES

    I'm a bit hesitative to address this problem: I've looked
    at it but don't feel comfortable enough with the source
    code... Chris, if you can find some time, could you please
    have a look at it?

  • Christoph Steinbeck

    Logged In: YES

    I will look at it as soon as I have some more time. Not
    likely to happen soon, but one never knows :-)

  • Christoph Steinbeck

    Logged In: YES

    Solved in CVS


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks