Skip to content

Commit

Permalink
Create chapter3.md
Browse files Browse the repository at this point in the history
  • Loading branch information
egonw committed Dec 24, 2018
0 parents commit 2630699
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions chapter3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Atoms, Bonds and Molecules

The basic objects in the CDK are the IAtom, IBond and IAtomContainer [1].
The name of the latter is somewhat misleading, as it contains
not just IAtoms but also IBonds. The primary use of the model is the
graph-based representation of molecules, where bonds are edges between
two atoms being the nodes [2].

Before we start, it is important to note that CDK 1.5.10 has an important
convention around object properties: when a property is unset, the ob-
ject’s field is set to null. This brings in sources for NullPointerExceptions,
but also allows us to distinguish between, for example, zero and unset for-
mal charge. In the former case, the formal charge value be set and have
a zero value; in the latter case, the field has a null value, indicating the
formal charge is currently unknown.

## Atoms

The CDK interface IAtom is the underlying data model of atoms. Creating
a new atom is fairly easy. For example, we can create an atom of element
type carbon, as defined by the element’s symbol that we pass as parameter
in the constructor:

```groovy
IAtom atom = new Atom("C");
```

## References

1. C. Steinbeck, Y. Han, S. Kuhn, O. Horlacher, E. Luttmann, E. Willighagen, The Chemistry Development Kit (CDK): An Open-Source Java Library for Chemo- and Bioinformatics, J. Chem. Inf. Comput. Sci. 2003, 43, 493–500.
2. A. T. Balaban, Applications of graph theory in chemistry, Journal of Chemical Information and Computer Sciences 1985, 25, 334–343.

0 comments on commit 2630699

Please sign in to comment.