Installation via pip install rdkit2ase
.
from rdkit2ase import rdkit2ase, ase2rdkit
atoms: ase.Atoms = rdkit2ase(mol)
mol = ase2rdkit(atoms)
from rdkit2ase import smiles2atoms
atoms: ase.Atoms = smiles2atoms("O")
print(atoms)
>>> Atoms(symbols='OH2', pbc=False)
If you have packmol (at least v20.15.0
) you
can use the rdkit2ase interface.
from rdkit2ase import pack, smiles2conformers
water = smiles2conformers("O", 2)
ethanol = smiles2conformers("CCO", 5)
density = 1000 # kg/m^3
box = pack([water, ethanol], [7, 5], density)
print(box)
>>> Atoms(symbols='C10H44O12', pbc=True, cell=[8.4, 8.4, 8.4])
rdkit2ase.ase2rdkit
won't be able to detect higher order bonds.