Collections:
Refresh Molecule in JSME Editor
How to refresh (read and reset) molecule created in JSME editor with the Web server?
✍: FYIcenter.com
If you want refresh molecule properties displayed in the JSME editor,
you can use a PHP script on the Web server to read and reset the molecule
structure in the JSME editor.
1. Create an HTML form with an input field for submitting the molecule structure to the server.
<form id="jmeForm" action="update-molecule.php" method="post"> <input id="jmeVar" type="hidden" name="JME"/> <button type="button" onclick="jsmeOnClick();">Update"</button> </form>
2. Create a JavaScript function jsmeOnClick(), which will be called when the "Update" button is clicked. It reads the molecule structure in JME format from the JSME editor and submit the structure to the server using the HTML form.
<script>
function jsmeOnClick() {
var jme = jsmeObj.jmeFile();
document.getElementById("jmeVar").value = jme;
document.getElementById("jmeForm").submit();
}
</script>
3. Retrieve the molecule structure on the server side in the PHP script, update-molecule.php.
$jme = _REQUEST["JME"]; # save the structure to database or to a file.
4. Generate HTML document with JavaScript code to load the molecule structure into the JSME editor.
$jme = _REQUEST["JME"];
$htm = <<< EndOfHtml
<script>
function jsmeOnLoad() {
jsmeObj = new JSApplet.JSME("jsme_container", "380px", "340px");
jsmeObj.readMolecule($jme);
}
</script>
EndOfHtml;
Note that you also use the jsmeObj.readGenericMolecularInput($jme) to load the molecule structure in JME format. But it will display the "ERROR: Invalid JME string" message on the JSME editor, for an empty structure.
So JSME has a bug in the readGenericMolecularInput() code for a given empty structure in JME format: "0 0".
⇒ JSME Molecule Editor Options
2023-04-13, 1072🔥, 0💬
Popular Posts:
Molecule Summary: ID: FYI-1000176 SMILES: COCC(=O)Cc1ccc(CC#N)cc1 Received at FYIcenter.com on: 2020...
Molecule Summary: ID: FYI-1004928 Names: InChIKey: RKVAFXCYOQTGHV-HMIIVJTLS A-LSMILES: Cc8cc(C)nc(NS...
Molecule Summary: ID: FYI-1014509 Names: InChIKey: ZNOYSGHPKOLDRJ-QZTJIDSGS A-NSMILES: OC[C@@H](O)CO...
Where to find tutorials on molecule visualization software PyMol? I want to know how to use PyMol. H...
Molecule Summary: ID: FYI-1001101 SMILES: CCOP(=O)(C)SCCN(C(C)C)C( C)CReceived at FYIcenter.com on: ...