Collections:
editor.struct().atoms - Get Atom List
How to get a list of atoms currently in the Ketcher editor with the editor.struct().atoms property?
✍: FYIcenter.com
If you want to get a list of atoms currently in the Ketcher editor, you can use the editor.struct().atoms property on the Ketcher Editor interface.
Here is an HTML document that shows you how to get a list of atoms in Ketcher editor and print detailed information of the fist atom.
<html> <!-- editor-get-first-atom.html Copyright (c) FYIcenter.com. --> <head> <title>Get the First Atom from Editor</title> </head> <body> <p>Create a molecule structure, then click generate button below the editor:</p> <iframe id=frmKetcher src="/ketcher/index.html" style="width: 680px; height: 400px;"></iframe> <p><button onclick="generate();">Get the First Atom</button></p> <p>Output:</p> <pre id=output style="background-color: #ddd;"></pre> <script> var ketcher = null; var display = document.getElementById("output"); function generate() { frm = document.getElementById("frmKetcher"); ketcher = frm.contentWindow.ketcher; editor = ketcher.editor; structure = editor.struct(); atoms = structure.atoms.entries(); first = atoms.next().value; display.innerHTML = JSON.stringify(first, undefined, 2); } </script> </body> </html>
Open the above HTML document on your local Web server. Draw a benzene molecule in the editor.
Click "Get the First Atom" button, you will see that detailed information of the first atom of the structure in the editor is displayed.
[ 0, { "label": "C", "fragment": 1, "alias": null, "isotope": 0, "radical": 0, "cip": null, "charge": 0, "rglabel": null, "attpnt": null, "implicitHCount": null, "explicitValence": -1, "valence": 4, "implicitH": 1, "pp": { "x": 1.5746705613885816, "y": 2.574248795956401, "z": 0 }, "sgs": {}, "ringBondCount": 0, "substitutionCount": 0, "unsaturatedAtom": 0, "hCount": 0, "aam": 0, "invRet": 0, "exactChangeFlag": 0, "rxnFragmentType": -1, "stereoLabel": null, "stereoParity": 0, "atomList": null, "neighbors": [ 13, 16 ], "badConn": false, "pseudo": "" } ]
⇒ editor.struct().bonds - Get Bond List
2023-12-01, 243🔥, 0💬
Popular Posts:
Molecule Summary: ID: FYI-1003976 Names: InChIKey: SOBPKJYDSKIMNI-UHFFFAOYS A-NSMILES: O=N(=O)c4ccc(...
Molecule Summary: ID: FYI-1000182 SMILES: COc2ccc(Cc1ccccc1)c(C)c2 Received at FYIcenter.com on: 202...
Molecule Summary: ID: FYI-1001108 SMILES: CCCC1=C(C(=O)NC2=C1C(=O) C3=C(C2=O)NC(=O)C(=C3CCC )C)CRecei...
Molecule Summary: ID: FYI-1002204 Names: InChIKey: ZOCSXAVNDGMNBV-UHFFFAOYS A-NSMILES: N#Cc2nn(c1c(C...
Molecule Summary: ID: FYI-1006423 Names: InChIKey: VZPPTFKEWNQSCG-BHGWPJFGS A-NSMILES: COc3cc(/C=N/c...