Interface IAtom

    • Method Detail

      • setCharge

        void setCharge​(Double charge)
        Sets the partial charge of this atom.
        Parameters:
        charge - The partial charge
        See Also:
        getCharge()
      • setImplicitHydrogenCount

        void setImplicitHydrogenCount​(Integer hydrogenCount)
        Sets the implicit hydrogen count of this atom.
        Parameters:
        hydrogenCount - The number of hydrogen atoms bonded to this atom.
        See Also:
        getImplicitHydrogenCount()
      • getTotalHydrogenCount

        default Integer getTotalHydrogenCount()
        Calculates the total number of hydrogens connected to this atom. The value is determined on demand from the implicit hydrogen count and the number of connected hydrogen atoms.
        Note: some hydrogens may be bridged (e.g. B2H6) so although the total number of hydrogens in the molecule is 6, each atom has a total hydrogen count of 4.
        Returns:
        the total hydrogen count or null if the implicit count is not set
      • setPoint2d

        void setPoint2d​(javax.vecmath.Point2d point2d)
        Sets a point specifying the location of this atom in a 2D space.
        Parameters:
        point2d - A point in a 2D plane
        See Also:
        getPoint2d()
      • setPoint3d

        void setPoint3d​(javax.vecmath.Point3d point3d)
        Sets a point specifying the location of this atom in 3D space.
        Parameters:
        point3d - A point in a 3-dimensional space
        See Also:
        getPoint3d()
      • setFractionalPoint3d

        void setFractionalPoint3d​(javax.vecmath.Point3d point3d)
        Sets a point specifying the location of this atom in a Crystal unit cell.
        Parameters:
        point3d - A point in a 3d fractional unit cell space
        See Also:
        getFractionalPoint3d(), Crystal
      • getPoint2d

        javax.vecmath.Point2d getPoint2d()
        Returns a point specifying the location of this atom in a 2D space.
        Returns:
        A point in a 2D plane. Null if unset.
        See Also:
        setPoint2d(javax.vecmath.Point2d)
      • getPoint3d

        javax.vecmath.Point3d getPoint3d()
        Returns a point specifying the location of this atom in a 3D space.
        Returns:
        A point in 3-dimensional space. Null if unset.
        See Also:
        setPoint3d(javax.vecmath.Point3d)
      • getContainer

        IAtomContainer getContainer()
        Access the IAtomContainer of which this atom is a member of. Because atoms can be in multiple molecules this method will only work if the atom has been accessed in the context of an IAtomContainer, for example:
        
         IAtomContainer mol  = new AtomContainer();
         IAtom          atom = new Atom(6);
        
         atom.getContainer(); // null
         mol.add(atom);
         atom.getContainer(); // still null
         mol.getAtom(0).getContainer(); // not-null, returns 'mol'
         
        Returns:
        the atom container or null if not accessed in the context of a container
      • getIndex

        int getIndex()
        Acces the index of an atom in the context of an IAtomContainer. If the index is not known, < 0 is returned.
        Returns:
        atom index or < 0 if the index is not known
      • bonds

        Iterable<IBond> bonds()
        Returns the bonds connected to this atom. If the bonds are not known an exception is thrown. This method will only throw an exception if getIndex() returns < 0 or getContainer() returns null.
        
        
         IAtom atom = ...;
        
         if (atom.getIndex() >= 0) {
           for (IBond bond : atom.bonds()) {
        
           }
         }
        
         if (atom.getContainer() != null) {
           for (IBond bond : atom.bonds()) {
        
           }
         }
        
         IAtomContainer mol = ...;
         // guaranteed not throw an exception
         for (IBond bond : mol.getAtom(i).bonds()) {
        
         }
         
        Returns:
        iterable of bonds
        Throws:
        UnsupportedOperationException - thrown if the bonds are not known
      • neighbors

        default Iterable<IAtom> neighbors()
        Iterable over the atoms connected to this atom (the neighbors). This is a convenience function which calls IBond.getOther(IAtom). If you need both the bond and the atom the idiom is:
        
         for (IBond bond : atom.bonds()) {
             IAtom nbor = bond.getOther(atom);
         }
         
        This will work but is less efficient:
        
         for (IAtom nbor : atom.neighbors()) {
             IAtom bond = atom.getBond(nbor); // slow!
         }
         
        Returns:
        the neighbors
      • getBondCount

        int getBondCount()
        Get the number of explicit bonds connected to this atom.
        Returns:
        the total bond count
      • getBond

        IBond getBond​(IAtom atom)
        Returns the bond connecting 'this' atom to the provided atom. If the atoms are not bonded, null is returned.
        Parameters:
        atom - the other atom
        Returns:
        the bond connecting the atoms
        Throws:
        UnsupportedOperationException - thrown if the bonds are not known
      • isAromatic

        default boolean isAromatic()
        Access whether this atom has been marked as aromatic. The default value is false and you must explicitly perceive aromaticity with one of the available models.
        Returns:
        aromatic status
        See Also:
        IChemObject.getFlag(int), Aromaticity
      • setIsAromatic

        default void setIsAromatic​(boolean arom)
        Mark this atom as being aromatic.
        Parameters:
        arom - aromatic status
        See Also:
        IChemObject.setFlag(int, boolean)
      • isInRing

        default boolean isInRing()
        Access whether this atom has been flagged as in a ring. The default value is false and you must explicitly find rings first.
        Returns:
        ring status
        See Also:
        IChemObject.getFlag(int), RingSearch
      • setIsInRing

        default void setIsInRing​(boolean ring)
        Mark this atom as being in a ring.
        Parameters:
        ring - ring status
        See Also:
        IChemObject.setFlag(int, boolean)
      • getMapIdx

        int getMapIdx()
        Access the map index for this atom.
        Returns:
        the map index (0 if not set)
      • setMapIdx

        void setMapIdx​(int mapidx)
        Set the map index for this atom.
        Parameters:
        mapidx - the new map index