[switching to jmol-developers]

Tina, I think what you are looking for is simply:

Vector bonds = (Vector)viewer.getProperty("object","bondInfo","selected");

for (int i = 0; i < bonds.size(); i++) {
  Hashtable bond = (Hashtable) bonds.get(i);
  Hashtable atom1 = (Hashtable) bond.get("atom1");
  Hashtable atom2 = (Hashtable) bond.get("atom2");
  int atomIndex1 = ((Integer) atom1.get("_pt")).intValue();
  int atomIndex1 = ((Integer) atom2.get("_pt")).intValue();
  String atomSymbol1 = (String) atom1.get("sym");
  String atomSymbol2 = (String) atom2.get("sym");
  int order = ((Integer) bond.get("order")).intValue();

 ...
}

Take a look for getBondInfo in ModelManager.java to see all that is in there.

The only caveate there is that you will have to check with your atomList
to remove bonds that are connections OUTSIDE the selected atom set. So you
might use something like:

Vector atomSet = (Vector)viewer.getProperty("object","atomList","selected");
BitSet atoms = new BitSet();
for (int i = 0; i < atomSet.size(); i++)
  atoms.set(((Integer) atomSet.get(i)).intValue());

and then check for

  if(atoms.get(atomIndex1) && atoms.get(atomIndex2))....


Bob Hanson


> Hi everybody,
> I want to select atoms graphically, save these atoms(something like
> atom[i].isSelected ? selected[j] = atom[i]) and use themfor further
> calculations within my code. Primarily I need to know whichof the selected
> atoms are bonded together (something likeisBonded(atom1, atom2)), the
> coordinates of the atoms (I know how to doTHIS) and other atoms which are
> bonded to this selected atoms. I have noidea how to do this...I´m using
> Jmol jmol-10.9.76 and the CdkJmolAdapter. What I did so far is:
> I read in a SDF File ,eval the String "select none;set picking atom;set
> display selected;";select some atoms by clicking.I know I can get the
> coordinates of the SELECTED atoms like this:Vector atomInfo =
> (Vector)viewer.getProperty("object", "atomList","selected");
> for(int i = 0; i< atomInfo.size(); i++){             int x = (Integer)
> atomInfo.elementAt(i);             coord = viewer.getAtomPoint3f(x);
>          }I also understood I can get the mol file like
> this:viewer.getProperty("string","extractModel","selected");
> But how can I get the atoms or ask something like
> "aBond(atomList[1],atomList[2])?". And can I save these selected atoms in
> a "model" so thatI can convert them into a CDK AtomContainer (with atoms
> and bonds)?
> I tried to get the selected BitSet, but getSelectedSet is a privatemethod,
> SelectionManager (and getAtomBitSet("selected")) or ModelManagercannot be
> accesed outside the package (I had a look how the bonds andatoms are
> extracted for "modelExtract"). Is there any other way? Can Iiterate  over
> atoms and bonds of the molecule in the viewer?
> Maybe it´s totally easy, but I don´t have any idea how to do this.
> Thankyou!
> Kind regards,Tina
>
>
> -------------------------------------------------------------------------Using
> Tomcat but need to do more? Need to support web services, security?Get
> stuff done quickly with pre-integrated technology to make your job
> easierDownload IBM WebSphere Application Server v.1.0.1 based on Apache
> Geronimohttp://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642_______________________________________________Jmol-users
> mailing
> [EMAIL PROTECTED]://lists.sourceforge.net/lists/listinfo/jmol-users
>



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Jmol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to