Use the ChemDoodle.readMOL() function to parse this data and return a Molecule data
You canĬertainly also set coordinate data this way, but you definitely don't want to be assigning coordinates yourself. There are no coordinates associated with the atoms, and that would make for pretty useless images.You will need to fully understand the entire Molecule API to adequately create them.There are a couple other downsides to this method as well: Script, you will see that the Molecule has 2 atoms and 1 bond. See how tedious that was? Imagine doing this for a Molecule with 10 atoms, or 100!!! Anyway, when you run this Web Components will automate this process for powerful functions. Ok, we are ready to load data! Manually Creating Dataīy far, the most tedious and inconvenient method of loading chemical data is by manually creating the data structures.īut, this will give us a nice overview of the Molecule data structure, and advanced users of ChemDoodle Molecule should have 0 atoms and 0 bonds. You can click on the Run button above to see this function in action the new
This created a new Molecule from the ChemDoodle WebĬomponents library by correctly finding the Molecule class in the ChemDoodle.structures Note that when calling the function, we sent in a newly created Molecule object by writing newĬ(). Going to create a JavaScript function, named alertMessage(). Remembering the alert() function that we used on the previous page, we are Structure and displays the number of atoms and the number of bonds it contains.
All data structures defined by the ChemDoodle WebĬomponents library reside in the ChemDoodle.structures package.īefore we continue, let's write a small function in JavaScript that takes a Molecule data These are the data structures that the components inĬhemDoodle Web Components take as input. To begin, let's discuss the data structures that are in play here, the Somehow you will need to get chemical data to these JavaScript functions.