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, 451🔥, 0💬
Popular Posts:
Molecule Summary: ID: FYI-1001331 SMILES: CC(C)(O[C@@H]1C[C@@H]([C @H](C[C@@H](C([C@]2(C)C= C3)=CC3=O)...
Molecule Summary: ID: FYI-1004719 Names: InChIKey: FVFLIQMADUVDSP-UHFFFAOYS A-MSMILES: CCC[Sn](Cl)(C...
Molecule Summary: ID: FYI-1003060 Names: InChIKey: REKCXFADWRLBAK-UHFFFAOYS A-NSMILES: N#Cc3cc(c2cc(...
Molecule Summary: ID: FYI-1002571 Names: InChIKey: ILWPJPFYJLULCI-UHFFFAOYS A-NSMILES: Cn2ncc(C(=O)N...
Molecule Summary: ID: FYI-1000322 SMILES: C[C@@H](Cn1cccn1)N[C@H]2 CCOC2=OReceived at FYIcenter.com ...