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, 819🔥, 0💬
Popular Posts:
Molecule Summary: ID: FYI-1001096 SMILES: C1=CC=CN=C1 Received at FYIcenter.com on: 2021-12-24
Molecule Summary: ID: FYI-1004315 Names: InChIKey: WEPBGSIAWZTEJR-UHFFFAOYS A-MSMILES: COc3c(c1ccc([...
Molecule Summary: ID: FYI-1003127 Names: ETHYL ALCOHOL; ETHANOL; InChIKey: LFQSCWFLJHTTHZ-UHFFFAOYS A...
Molecule Summary: ID: FYI-1005860 Names: InChIKey: LANWUAYMZWWASX-UHFFFAOYS A-NSMILES: CN1C(=O)NCC1C...
How Stereoinformation is stored in in SDF/Mol V3000 files? Similar to SDF/Mol V2000, stereoinformati...