Skip to content

Commit

Permalink
move fast and break things...
Browse files Browse the repository at this point in the history
  • Loading branch information
corinwagen committed Jan 1, 2024
1 parent f62199a commit 911e976
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cctk/molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -1580,7 +1580,7 @@ def new_from_smiles(cls, smiles, max_num_atoms=None):
raise ValueError(f"Molecule could not be generated from SMILES ``{smiles}`` -- invalid chemistry!\n{e}")

rdkm = Chem.AddHs(rdkm)
if (max_num_atoms is not None) and (rdkm.GetNumAtoms(rdkm) > max_num_atoms):
if (max_num_atoms is not None) and (rdkm.GetNumAtoms() > max_num_atoms):
raise ValueError(f"Number of atoms exceeds user-defined threshold ``{max_num_atoms}``")

# https://github.com/rdkit/rdkit/issues/1433
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
packages=["cctk", "cctk.data", "cctk.groups"],
# include_package_data=True,
package_data={"cctk.data": ["*"], "cctk.groups": ["*"],},
version="v0.2.20",
version="v0.2.21",
license="Apache 2.0",
description="computational chemistry toolkit",
author="Corin Wagen and Eugene Kwan",
author_email="[email protected]",
url="https://github.com/ekwan/cctk",
download_url="https://github.com/ekwan/cctk/archive/v0.2.20.tar.gz",
download_url="https://github.com/ekwan/cctk/archive/v0.2.21.tar.gz",
install_requires=["numpy", "networkx", "importlib_resources", "scipy", "pyahocorasick", "basis_set_exchange", "pyyaml"],
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down
3 changes: 3 additions & 0 deletions test/test_molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ def test_rdkit(self):
mol = cctk.Molecule.new_from_name("acetic acid")
self.assertEqual(len(mol.atomic_numbers), 8)

with self.assertRaises(ValueError):
mol = cctk.Molecule.new_from_smiles("CCCCCCCCCCCCCCCCCCCC", max_num_atoms=10)

def test_fragment(self):
m = cctk.GaussianFile.read_file("test/static/periodic.gjf").get_molecule()
m = m.assign_connectivity(periodic_boundary_conditions=np.array([20, 20, 20]))
Expand Down

0 comments on commit 911e976

Please sign in to comment.