I'm trying to add bonds explicitly to a structure loaded in .xyz format.

The structure intentionally has unrealistic atom positions.

The structure is loaded like so:

myAppConsole.execute("set autobond OFF");
myViewer.loadInline(molAsXyz);

The problem is that the viewer loads N atoms as N molecules, and each
molecule lists an atom count of zero:

# xyz:4
No comment.
C    3.952    2.132    3.339
C    0.321    1.781    2.229
C    0.490    1.193    2.953
C    2.701    1.473    0.464

// Java:final int nMols =
myViewer.getModelSet().getMolecules().length;for (int i = 0; i <
nMols; ++i) {
    System.out.println(String.format("Mol %d - Atom count
%d",i,viewer.getModelSet().getMolecules()[i].atomCount));
}// output://   Mol 0 - Atom count 0//   Mol 1 - Atom count 0//   Mol
2 - Atom count 0//   Mol 3 - Atom count 0

The viewer is displaying the four atoms in their correct positions.

How can I force the .xyz to load into a single molecule such that I may add
in bonds like so:

Bond[] bonds = new Bond[knownBondCount];// ...
bonds[i] = new Bond(atom1,atom2,1,(short)0,(short)0);// ...
JmolMolecule mol = myViewer.getModelSet().getMolecules()[0];for (int i
= 0; i < mol.atomCount; ++i) {
    final Atom atom = (Atom)mol.nodes[i];
    atom.setBonds(bonds); // of course the 'bonds' value passed
changes for each atom in reality.
}

Is there a format better suited for this purpose than .xyz?

David
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to