Rajarshi wrote:
> I can see that I can create a new Bond but is there any function to
> get the atoms that constitute the bond and the order?
If you are building an implementation of a ModelReader for a new file type
then you can just the members directly.
bond.atomIndex1
bond.atomIndex2
bond.order
But, I don't think that is what you want to do.
> In ModelAdapter I
> see an abstract class BondIterator but I see no implementation of it (or
> else I missed it!).
>
> Is there a way to get the atoms and bond order of a Bond?
If you are a client of the ModelAdapter API, then you use the BondIterator.
AtomIterator has a method which will return a UniqueID for each atom
public abstract class AtomIterator {
public abstract boolean hasNext();
...
abstract public Object getUniqueID();
...
}
the BondIterator API is ...
public abstract class BondIterator {
public abstract boolean hasNext();
public abstract Object getAtomUid1();
public abstract Object getAtomUid2();
public abstract int getOrder();
}
Iterate through all of the atoms. save the UniqueIDs in a HashTable which
maps the UniqueID to the appropriate instance of YourAtomDataStructure.
Then, iterate through all the bonds. Use getAtomUid1() and getAtomUid2().
Look them up in the hash table. That will return the appropriate instances
of YourAtomDataStructure.
Note that the getOrder() routine returns more than just an int. It is
encoded to support aromatic, hbond, and stero bonds as follows:
public final static byte ORDER_AROMATIC = (byte)(1 << 2);
public final static byte ORDER_HBOND = (byte)(1 << 6);
public final static byte ORDER_STEREO_NEAR = (byte)((1 << 3) | 1);
public final static byte ORDER_STEREO_FAR = (byte)((2 << 3) | 2);
For an example you can take a look at viewer/datamodel/FrameBuilder.java
Q: Out of curiosity, why are you calling the ModelAdapter as a client?
Miguel
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
Jmol-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jmol-developers