15 lines
344 B
Python
15 lines
344 B
Python
from openbabel import openbabel
|
|
|
|
mol = openbabel.OBMol()
|
|
print(mol.NumAtoms()) #Should print 0 (atoms)
|
|
|
|
a = mol.NewAtom()
|
|
a.SetAtomicNum(6) # carbon atom
|
|
a.SetVector(0.0, 1.0, 2.0) # coordinates
|
|
|
|
b = mol.NewAtom()
|
|
mol.AddBond(1, 2, 1) # atoms indexed from 1
|
|
print(mol.NumAtoms()) #Should print 2 (atoms)
|
|
print(mol.NumBonds())
|
|
|
|
mol.Clear(); |