For example , oxygen atoms always have two bonds with other atoms , carbon atoms always have four bonds with other atoms , and nitrogen atoms always have three bonds with other atoms . A molecule may consist of atoms of a single chemical element , as with oxygen ( O2 ) , or of different elements , as with water ( H2O ) . Atoms and complexes connected by non-covalent bonds such as hydrogen bonds or ionic bonds are generally not considered single molecules .