Hello Everyone,

I am trying to get the list of atoms of a structure using the jmol applet. I
am using the method "jmolGetPropertyAsArray()" for the purpose. My code is
provided lower in this mail.
The application loads the applet and displays the protein structure but the
atom list is not shown.  It always returns the length as 0 for the list of
atoms.

Could someone please suggest what I may be doing wrong?

Thanks in advance.

Regards,
Vikash

Code:

 <head>
  <title>Trying to get atom names</title>
  <script src="../Jmol.js" type="text/javascript"></script>
  <script type="text/javascript">
      jmolInitialize("../");
      jmolSetAppletColor("black");
      jmolApplet(500 , "load 1MBA.pdb");

var appletIDsuffix = "0";
var applet
var filePathName
var fileType
var fileName

function atomident()
{
        applet = document.getElementById("jmolApplet"  + appletIDsuffix );
        var atoms= jmolGetPropertyAsArray("atomInfo","all");
        //var atoms=
jmolGetPropertyAsArray("atomInfo","selected",appletIDsuffix);
        //var atoms = jmolGetPropertyAsJSON("atominfo", "atomno=1");
        //alert(jmolDecodeJSON(atoms));
        var tx = "Atoms list:<ol>";
        var tmpvk = atoms.length;

        for (var i=0; i<atoms.length;i++)
        {       tx += "<li>" + elemName(atoms[i].elemno, atoms[i].sym);
                       tx += " named " + atomName(atoms[i].name);

                tx += "</li>";

        }
        document.getElementById("result").innerHTML = tx + "</ol>" + tmpvk ;
        jmolScript("select none");
}

</script>
</head>
<body>
  <form>
        <br>
        <input type="button" value="Atom Data" onClick="atomident()">

        <br>
        this is the result area:
        <br>
        <table border="1">
            <tr>
            <td>
            <div id="result">...</div>
            </td>
            </tr>
        </table>
  </form>
</body>
------------------------------------------------------------------------------
_______________________________________________
Jmol-developers mailing list
Jmol-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to