Skip to content

zincware/molify

Repository files navigation

zincware codecov PyPI version DOI Docs status

molify - Molecular Structure Interface with RDKit, ASE, Packmol and NetworkX

Installation via pip install molify. For more information please visit the documentation.

A common use case is to create 3D structures from SMILES strings. This can be achieved using the molify.rdkit2ase function.

import ase
from rdkit import Chem
from molify import rdkit2ase, ase2rdkit

mol = Chem.MolFromSmiles("O")
atoms: ase.Atoms = rdkit2ase(mol)
mol = ase2rdkit(atoms)

Because this is such a common use case, there is a convenience function molify.smiles2atoms that combines the two steps.

import ase
from molify import smiles2atoms

atoms: ase.Atoms = smiles2atoms("O")

print(atoms)
>>> Atoms(symbols='OH2', pbc=False)

Packmol Interface

Given the molecular units, you can build periodic boxes with a given density using the molify.pack function.

The molify package ships with an installation of packmol. If you like packmol, give it a star on GitHub!

from molify 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])

Many additional features are described in the documentation.

About

Create atomistic structures with ASE, rdkit and packmol

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages