From 7868faac62d76434867a746c5da5266d27c13f7e Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Fri, 20 Sep 2024 19:22:59 +0200 Subject: [PATCH 01/35] Write example script. --- python/examples/8-showing_custom_bonds.py | 230 ++++++++++++++++++++++ 1 file changed, 230 insertions(+) create mode 100644 python/examples/8-showing_custom_bonds.py diff --git a/python/examples/8-showing_custom_bonds.py b/python/examples/8-showing_custom_bonds.py new file mode 100644 index 000000000..19f2b3e70 --- /dev/null +++ b/python/examples/8-showing_custom_bonds.py @@ -0,0 +1,230 @@ +""" +Showing custom bonds +==================== + +This example demonstrates how to add shapes into the chemiscope output such +that custom bonds that would not normally be assigned by ASE can be rendered. + +""" + +# %% +# +import stk +import stko +import ase.io +import pathlib +import chemiscope + +working_path = pathlib.Path(__file__).resolve().parent +data_path = working_path / "data" + +######################################################################## +# This is just for development, where I build the library of structures. +energy = stko.UFFEnergy() +analyser = stko.molecule_analysis.GeometryAnalyser() +xyz_path = data_path / "stkbuilt.xyz" +string = "" + +host = stk.ConstructedMolecule( + topology_graph=stk.cage.FourPlusSix( + building_blocks=( + stk.BuildingBlock( + smiles="NC1CCCCC1N", + functional_groups=[ + stk.PrimaryAminoFactory(), + ], + ), + stk.BuildingBlock( + smiles="O=Cc1cc(C=O)cc(C=O)c1", + functional_groups=[stk.AldehydeFactory()], + ), + ), + optimizer=stk.MCHammer(), + ), +) +molecule = stk.ConstructedMolecule( + topology_graph=stk.host_guest.Complex( + host=stk.BuildingBlock.init_from_molecule(host), + guests=stk.host_guest.Guest( + building_block=stk.BuildingBlock("[Br][Br]"), + ), + ), +) +teststring = stk.XyzWriter().to_string(molecule) +teststring = teststring.split("\n") +teststring[1] = ( + f"e='{energy.get_energy(molecule)}' " + f"rg='{analyser.get_radius_gyration(molecule)}'" +) +string += "\n".join(teststring) + +bb1 = stk.BuildingBlock( + smiles="NCCN", + functional_groups=[stk.PrimaryAminoFactory()], +) +bb2 = stk.BuildingBlock( + smiles="O=CC(C=O)C=O", + functional_groups=[stk.AldehydeFactory()], +) +molecule = stk.ConstructedMolecule( + topology_graph=stk.cage.FourPlusSix((bb1, bb2)), +) +molecule.write(data_path / "unoptcage.mol") +teststring = stk.XyzWriter().to_string(molecule) +teststring = teststring.split("\n") +teststring[1] = ( + f"e='{energy.get_energy(molecule)}' " + f"rg='{analyser.get_radius_gyration(molecule)}'" +) +string += "\n".join(teststring) + +molecule = stk.ConstructedMolecule( + topology_graph=stk.cage.FourPlusSix( + building_blocks=(bb1, bb2), + optimizer=stk.MCHammer(), + ) +) +teststring = stk.XyzWriter().to_string(molecule) +teststring = teststring.split("\n") +teststring[1] = ( + f"e='{energy.get_energy(molecule)}' " + f"rg='{analyser.get_radius_gyration(molecule)}'" +) +string += "\n".join(teststring) + + +palladium_atom = stk.BuildingBlock( + smiles="[Pd+2]", + functional_groups=(stk.SingleAtom(stk.Pd(0, charge=2)) for i in range(4)), + position_matrix=[[0.0, 0.0, 0.0]], +) +bb1 = stk.BuildingBlock( + smiles=("C1=NC=CC(C2=CC=CC(C3=C" "C=NC=C3)=C2)=C1"), + functional_groups=[ + stk.SmartsFunctionalGroupFactory( + smarts="[#6]~[#7X2]~[#6]", + bonders=(1,), + deleters=(), + ), + ], +) +molecule = stk.ConstructedMolecule( + stk.cage.M2L4Lantern( + building_blocks=(palladium_atom, bb1), + # Ensure that bonds between the + # GenericFunctionalGroups of the ligand and the + # SingleAtom functional groups of the metal are + # dative. + reaction_factory=stk.DativeReactionFactory( + stk.GenericReactionFactory( + bond_orders={ + frozenset( + { + stk.GenericFunctionalGroup, + stk.SingleAtom, + } + ): 9, + }, + ), + ), + ), +) +molecule.write(data_path / "metalcage.mol") +teststring = stk.XyzWriter().to_string(molecule) +teststring = teststring.split("\n") +teststring[1] = ( + f"e='{energy.get_energy(molecule)}' " + f"rg='{analyser.get_radius_gyration(molecule)}'" +) +string += "\n".join(teststring) + + +with xyz_path.open("w") as f: + f.write(string) + +######################################################################## + + +print( + "one change I am interested in, is if you want to use the standard " + "load xyz > chemiscope workflow, like here. " + "or, if I use rdkit/stk to provide the graph automatically? " + "I would not want to add any dependancies in doing so" +) + + +# %% +# +# Load structures from an extended xyz file. +frames = ase.io.read(xyz_path, ":") + + +# %% +# +# Write to json file without added shapes and note that the XX-XX bonds are +# missing. + +chemiscope.write_input( + "noshape_example.json.gz", + frames=frames, + properties=chemiscope.extract_properties(frames, only=["e", "rg"]), + meta=dict(name="Missing bonds by automation."), + settings=chemiscope.quick_settings(x="rg", y="e", color=""), +) + + +# %% +# +# Compute the shape dicionary from the structures based on XX. +mol1 = stk.BuildingBlock.init_from_file(data_path / "unoptcage.mol") +mol1_bonds = tuple( + (bond.get_atom1().get_id(), bond.get_atom2().get_id()) for bond in mol1.get_bonds() +) + +mol3 = stk.BuildingBlock.init_from_file(data_path / "metalcage.mol") +mol3_bonds = tuple( + (bond.get_atom1().get_id(), bond.get_atom2().get_id()) for bond in mol3.get_bonds() +) +bonds_per_frames = { + # Here, we do it by hand to fill in some issues. + 0: ((0, 60), (22, 132), (30, 85), (34, 150), (4, 96), (46, 169)), + 2: ((3, 48), (11, 56), (19, 72)), + # In these two examples, we are using "fake", unoptimised models and show + # how to generate these from a mol file. + # Although these examples currently require a new dependancy, so I can + # alter them as needed? + 1: mol1_bonds, + 3: mol3_bonds, +} + +shape_dict = chemiscope.convert_bonds_as_shapes( + frames=frames, + bonds_per_frames=bonds_per_frames, +) +# Write the shape string for settings to turn them on automatically. +shape_string = ",".join(shape_dict.keys()) + +# %% +# +# Write to json file with added shapes and note that the XX-XX bonds are +# present. +chemiscope.write_input( + "shape_example.json.gz", + frames=frames, + properties=chemiscope.extract_properties(frames, only=["e", "rg"]), + meta=dict(name="Added some bonds."), + settings=chemiscope.quick_settings( + x="rg", + y="e", + color="", + structure_settings={ + "shape": shape_string, + "atoms": True, + "bonds": True, + "spaceFilling": False, + }, + ), + shapes=shape_dict, +) + +raise SystemExit From f37c99e6a4324df47729c533dc9cd1a0322547fd Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Fri, 20 Sep 2024 19:23:25 +0200 Subject: [PATCH 02/35] Write bonds to shape function, add to init. --- python/chemiscope/__init__.py | 1 + python/chemiscope/structures/__init__.py | 6 +- python/chemiscope/structures/_bonding.py | 88 ++++++++++++++++++++++++ 3 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 python/chemiscope/structures/_bonding.py diff --git a/python/chemiscope/__init__.py b/python/chemiscope/__init__.py index 9723959c1..4a137f8d5 100644 --- a/python/chemiscope/__init__.py +++ b/python/chemiscope/__init__.py @@ -10,6 +10,7 @@ ellipsoid_from_tensor, extract_properties, librascal_atomic_environments, + convert_bonds_as_shapes, ) from .explore import explore, metatensor_featurizer # noqa: F401 from .version import __version__ # noqa: F401 diff --git a/python/chemiscope/structures/__init__.py b/python/chemiscope/structures/__init__.py index 3f6fa9991..165b594ac 100644 --- a/python/chemiscope/structures/__init__.py +++ b/python/chemiscope/structures/__init__.py @@ -14,13 +14,17 @@ center_shape, ellipsoid_from_tensor, ) - +from ._bonding import convert_bonds_as_shapes # noqa: F401 from ._ase import ( # noqa: F401 ase_merge_pi_frames, ase_tensors_to_ellipsoids, ase_vectors_to_arrows, ) +__all__ = [ + "convert_bonds_as_shapes", +] + def _guess_adapter(frames): """ diff --git a/python/chemiscope/structures/_bonding.py b/python/chemiscope/structures/_bonding.py new file mode 100644 index 000000000..cbe2cd33d --- /dev/null +++ b/python/chemiscope/structures/_bonding.py @@ -0,0 +1,88 @@ +"""Module for handling bonding in chemiscope.""" + +try: + import ase + + HAVE_ASE = True +except ImportError: + HAVE_ASE = False + + +def convert_bonds_as_shapes( + frames: list[ase.Atoms], + bonds_per_frames: dict[int, list[tuple[int, int]]], +) -> dict[str, dict]: + """Convert connections between atom ids in each structure to shapes. + + Parameters: + + frames: + List of ase.Atoms object, which each are an molecule in chemiscope. + + bonds_per_frames: + The bonds you want to add between atoms with the given ids. The key + to the dictionary should align with the id of the molecule in + frames. + + """ + shape_dict: dict[str, dict] = {} + max_length = 0 + for fid, molecule in enumerate(frames): + bonds_to_add = bonds_per_frames[fid] + + for bid, bond_info in enumerate(bonds_to_add): + bname = f"bond_{bid}" + + # Compute the bond vector. + position_matrix = molecule.get_positions() + bond_geometry = { + "vector": ( + position_matrix[bond_info[1]] - position_matrix[bond_info[0]] + ).tolist(), + "position": (position_matrix[bond_info[0]]).tolist(), + } + + # Add the bond name to the dictionary to be iterated through. + if bname not in shape_dict: + if bname == "bond_0": + shape_dict[bname] = { + "kind": "cylinder", + "parameters": { + "global": {"radius": 0.12, "color": "#fc5500"}, + "structure": [], + }, + } + + else: + num_to_add = len(shape_dict["bond_0"]["parameters"]["structure"]) + shape_dict[bname] = { + "kind": "cylinder", + "parameters": { + "global": {"radius": 0.12, "color": "#fc5500"}, + # Add zero placements for previously non-existant + # bond shapes up to the length of bond_0 -1, + # because that should already be at the current + # length that the new one should be. + "structure": [ + {"vector": [0, 0, 0], "position": [0, 0, 0]} + for i in range(num_to_add - 1) + ], + }, + } + + # Add vector to the shape dictionary. + shape_dict[bname]["parameters"]["structure"].append(bond_geometry) + max_length = max( + (max_length, len(shape_dict[bname]["parameters"]["structure"])) + ) + + # Fill in bond shapes that are not the same length as the max length. + for bname in shape_dict.keys(): + missing = max_length - len(shape_dict[bname]["parameters"]["structure"]) + if missing == 0: + continue + for i in range(missing): + fake_bond = {"vector": [0, 0, 0], "position": [0, 0, 0]} + shape_dict[bname]["parameters"]["structure"].append(fake_bond) + + return shape_dict From d81dd4fa8520e07a97e6bc758c0f25daf7ad5658 Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Fri, 20 Sep 2024 19:23:36 +0200 Subject: [PATCH 03/35] Save outputs. --- python/examples/data/metalcage.mol | 272 +++++++++++++++++ python/examples/data/stkbuilt.xyz | 460 +++++++++++++++++++++++++++++ python/examples/data/unoptcage.mol | 176 +++++++++++ 3 files changed, 908 insertions(+) create mode 100644 python/examples/data/metalcage.mol create mode 100644 python/examples/data/stkbuilt.xyz create mode 100644 python/examples/data/unoptcage.mol diff --git a/python/examples/data/metalcage.mol b/python/examples/data/metalcage.mol new file mode 100644 index 000000000..f0dfe7c02 --- /dev/null +++ b/python/examples/data/metalcage.mol @@ -0,0 +1,272 @@ + + RDKit 3D + + 0 0 0 0 0 0 0 0 0 0999 V3000 +M V30 BEGIN CTAB +M V30 COUNTS 122 136 0 0 0 +M V30 BEGIN ATOM +M V30 1 Pd 0.0000 6.7061 0.0000 0 CHG=2 +M V30 2 Pd 0.0000 -6.7061 0.0000 0 CHG=2 +M V30 3 C 14.6172 4.7881 -0.6066 0 +M V30 4 N 13.4123 4.8933 -0.0000 0 +M V30 5 C 12.9018 3.7993 0.5932 0 +M V30 6 C 13.5659 2.5874 0.5996 0 +M V30 7 C 14.7939 2.4749 -0.0171 0 +M V30 8 C 15.4939 1.1926 -0.0090 0 +M V30 9 C 16.8711 1.1292 -0.0077 0 +M V30 10 C 17.5565 -0.0840 0.0004 0 +M V30 11 C 16.8578 -1.2740 0.0075 0 +M V30 12 C 15.4780 -1.2425 0.0064 0 +M V30 13 C 14.7497 -2.4936 0.0146 0 +M V30 14 C 13.5220 -2.5919 0.6235 0 +M V30 15 C 12.8806 -3.8096 0.5967 0 +M V30 16 N 13.4123 -4.8933 0.0000 0 +M V30 17 C 14.6118 -4.8155 -0.6003 0 +M V30 18 C 15.2647 -3.6219 -0.5866 0 +M V30 19 C 14.8141 -0.0144 -0.0018 0 +M V30 20 C 15.3148 3.5984 -0.6246 0 +M V30 21 H 14.9944 5.6977 -1.0750 0 +M V30 22 H 11.9249 3.8319 1.1009 0 +M V30 23 H 13.1630 1.6997 1.0741 0 +M V30 24 H 17.4342 2.0590 -0.0132 0 +M V30 25 H 18.6349 -0.1061 0.0012 0 +M V30 26 H 17.3723 -2.2363 0.0139 0 +M V30 27 H 13.0431 -1.7455 1.1225 0 +M V30 28 H 11.9020 -3.9029 1.0772 0 +M V30 29 H 15.0316 -5.7081 -1.0820 0 +M V30 30 H 16.2391 -3.5986 -1.0858 0 +M V30 31 H 13.7460 0.0126 -0.0026 0 +M V30 32 H 16.2634 3.5747 -1.1195 0 +M V30 33 C 0.6066 4.7881 14.6172 0 +M V30 34 N 0.0000 4.8933 13.4123 0 +M V30 35 C -0.5932 3.7993 12.9018 0 +M V30 36 C -0.5996 2.5874 13.5659 0 +M V30 37 C 0.0171 2.4749 14.7939 0 +M V30 38 C 0.0090 1.1926 15.4939 0 +M V30 39 C 0.0077 1.1292 16.8711 0 +M V30 40 C -0.0004 -0.0840 17.5565 0 +M V30 41 C -0.0075 -1.2740 16.8578 0 +M V30 42 C -0.0064 -1.2425 15.4780 0 +M V30 43 C -0.0146 -2.4936 14.7497 0 +M V30 44 C -0.6235 -2.5919 13.5220 0 +M V30 45 C -0.5967 -3.8096 12.8806 0 +M V30 46 N 0.0000 -4.8933 13.4123 0 +M V30 47 C 0.6003 -4.8155 14.6118 0 +M V30 48 C 0.5866 -3.6219 15.2647 0 +M V30 49 C 0.0018 -0.0144 14.8141 0 +M V30 50 C 0.6246 3.5984 15.3148 0 +M V30 51 H 1.0750 5.6977 14.9944 0 +M V30 52 H -1.1009 3.8319 11.9249 0 +M V30 53 H -1.0741 1.6997 13.1630 0 +M V30 54 H 0.0132 2.0590 17.4342 0 +M V30 55 H -0.0012 -0.1061 18.6349 0 +M V30 56 H -0.0139 -2.2363 17.3723 0 +M V30 57 H -1.1225 -1.7455 13.0431 0 +M V30 58 H -1.0772 -3.9029 11.9020 0 +M V30 59 H 1.0820 -5.7081 15.0316 0 +M V30 60 H 1.0858 -3.5986 16.2391 0 +M V30 61 H 0.0026 0.0126 13.7460 0 +M V30 62 H 1.1195 3.5747 16.2634 0 +M V30 63 C -14.6172 4.7881 0.6066 0 +M V30 64 N -13.4123 4.8933 0.0000 0 +M V30 65 C -12.9018 3.7993 -0.5932 0 +M V30 66 C -13.5659 2.5874 -0.5996 0 +M V30 67 C -14.7939 2.4749 0.0171 0 +M V30 68 C -15.4939 1.1926 0.0090 0 +M V30 69 C -16.8711 1.1292 0.0077 0 +M V30 70 C -17.5565 -0.0840 -0.0004 0 +M V30 71 C -16.8578 -1.2740 -0.0075 0 +M V30 72 C -15.4780 -1.2425 -0.0064 0 +M V30 73 C -14.7497 -2.4936 -0.0146 0 +M V30 74 C -13.5220 -2.5919 -0.6235 0 +M V30 75 C -12.8806 -3.8096 -0.5967 0 +M V30 76 N -13.4123 -4.8933 -0.0000 0 +M V30 77 C -14.6118 -4.8155 0.6003 0 +M V30 78 C -15.2647 -3.6219 0.5866 0 +M V30 79 C -14.8141 -0.0144 0.0018 0 +M V30 80 C -15.3148 3.5984 0.6246 0 +M V30 81 H -14.9944 5.6977 1.0750 0 +M V30 82 H -11.9249 3.8319 -1.1009 0 +M V30 83 H -13.1630 1.6997 -1.0741 0 +M V30 84 H -17.4342 2.0590 0.0132 0 +M V30 85 H -18.6349 -0.1061 -0.0012 0 +M V30 86 H -17.3723 -2.2363 -0.0139 0 +M V30 87 H -13.0431 -1.7455 -1.1225 0 +M V30 88 H -11.9020 -3.9029 -1.0772 0 +M V30 89 H -15.0316 -5.7081 1.0820 0 +M V30 90 H -16.2391 -3.5986 1.0858 0 +M V30 91 H -13.7460 0.0126 0.0026 0 +M V30 92 H -16.2634 3.5747 1.1195 0 +M V30 93 C -0.6066 4.7881 -14.6172 0 +M V30 94 N -0.0000 4.8933 -13.4123 0 +M V30 95 C 0.5932 3.7993 -12.9018 0 +M V30 96 C 0.5996 2.5874 -13.5659 0 +M V30 97 C -0.0171 2.4749 -14.7939 0 +M V30 98 C -0.0090 1.1926 -15.4939 0 +M V30 99 C -0.0077 1.1292 -16.8711 0 +M V30 100 C 0.0004 -0.0840 -17.5565 0 +M V30 101 C 0.0075 -1.2740 -16.8578 0 +M V30 102 C 0.0064 -1.2425 -15.4780 0 +M V30 103 C 0.0146 -2.4936 -14.7497 0 +M V30 104 C 0.6235 -2.5919 -13.5220 0 +M V30 105 C 0.5967 -3.8096 -12.8806 0 +M V30 106 N -0.0000 -4.8933 -13.4123 0 +M V30 107 C -0.6003 -4.8155 -14.6118 0 +M V30 108 C -0.5866 -3.6219 -15.2647 0 +M V30 109 C -0.0018 -0.0144 -14.8141 0 +M V30 110 C -0.6246 3.5984 -15.3148 0 +M V30 111 H -1.0750 5.6977 -14.9944 0 +M V30 112 H 1.1009 3.8319 -11.9249 0 +M V30 113 H 1.0741 1.6997 -13.1630 0 +M V30 114 H -0.0132 2.0590 -17.4342 0 +M V30 115 H 0.0012 -0.1061 -18.6349 0 +M V30 116 H 0.0139 -2.2363 -17.3723 0 +M V30 117 H 1.1225 -1.7455 -13.0431 0 +M V30 118 H 1.0772 -3.9029 -11.9020 0 +M V30 119 H -1.0820 -5.7081 -15.0316 0 +M V30 120 H -1.0858 -3.5986 -16.2391 0 +M V30 121 H -0.0026 0.0126 -13.7460 0 +M V30 122 H -1.1195 3.5747 -16.2634 0 +M V30 END ATOM +M V30 BEGIN BOND +M V30 1 2 3 4 +M V30 2 1 4 5 +M V30 3 2 5 6 +M V30 4 1 6 7 +M V30 5 1 7 8 +M V30 6 2 8 9 +M V30 7 1 9 10 +M V30 8 2 10 11 +M V30 9 1 11 12 +M V30 10 1 12 13 +M V30 11 2 13 14 +M V30 12 1 14 15 +M V30 13 2 15 16 +M V30 14 1 16 17 +M V30 15 2 17 18 +M V30 16 2 12 19 +M V30 17 2 7 20 +M V30 18 1 20 3 +M V30 19 1 19 8 +M V30 20 1 18 13 +M V30 21 1 3 21 +M V30 22 1 5 22 +M V30 23 1 6 23 +M V30 24 1 9 24 +M V30 25 1 10 25 +M V30 26 1 11 26 +M V30 27 1 14 27 +M V30 28 1 15 28 +M V30 29 1 17 29 +M V30 30 1 18 30 +M V30 31 1 19 31 +M V30 32 1 20 32 +M V30 33 2 33 34 +M V30 34 1 34 35 +M V30 35 2 35 36 +M V30 36 1 36 37 +M V30 37 1 37 38 +M V30 38 2 38 39 +M V30 39 1 39 40 +M V30 40 2 40 41 +M V30 41 1 41 42 +M V30 42 1 42 43 +M V30 43 2 43 44 +M V30 44 1 44 45 +M V30 45 2 45 46 +M V30 46 1 46 47 +M V30 47 2 47 48 +M V30 48 2 42 49 +M V30 49 2 37 50 +M V30 50 1 50 33 +M V30 51 1 49 38 +M V30 52 1 48 43 +M V30 53 1 33 51 +M V30 54 1 35 52 +M V30 55 1 36 53 +M V30 56 1 39 54 +M V30 57 1 40 55 +M V30 58 1 41 56 +M V30 59 1 44 57 +M V30 60 1 45 58 +M V30 61 1 47 59 +M V30 62 1 48 60 +M V30 63 1 49 61 +M V30 64 1 50 62 +M V30 65 2 63 64 +M V30 66 1 64 65 +M V30 67 2 65 66 +M V30 68 1 66 67 +M V30 69 1 67 68 +M V30 70 2 68 69 +M V30 71 1 69 70 +M V30 72 2 70 71 +M V30 73 1 71 72 +M V30 74 1 72 73 +M V30 75 2 73 74 +M V30 76 1 74 75 +M V30 77 2 75 76 +M V30 78 1 76 77 +M V30 79 2 77 78 +M V30 80 2 72 79 +M V30 81 2 67 80 +M V30 82 1 80 63 +M V30 83 1 79 68 +M V30 84 1 78 73 +M V30 85 1 63 81 +M V30 86 1 65 82 +M V30 87 1 66 83 +M V30 88 1 69 84 +M V30 89 1 70 85 +M V30 90 1 71 86 +M V30 91 1 74 87 +M V30 92 1 75 88 +M V30 93 1 77 89 +M V30 94 1 78 90 +M V30 95 1 79 91 +M V30 96 1 80 92 +M V30 97 2 93 94 +M V30 98 1 94 95 +M V30 99 2 95 96 +M V30 100 1 96 97 +M V30 101 1 97 98 +M V30 102 2 98 99 +M V30 103 1 99 100 +M V30 104 2 100 101 +M V30 105 1 101 102 +M V30 106 1 102 103 +M V30 107 2 103 104 +M V30 108 1 104 105 +M V30 109 2 105 106 +M V30 110 1 106 107 +M V30 111 2 107 108 +M V30 112 2 102 109 +M V30 113 2 97 110 +M V30 114 1 110 93 +M V30 115 1 109 98 +M V30 116 1 108 103 +M V30 117 1 93 111 +M V30 118 1 95 112 +M V30 119 1 96 113 +M V30 120 1 99 114 +M V30 121 1 100 115 +M V30 122 1 101 116 +M V30 123 1 104 117 +M V30 124 1 105 118 +M V30 125 1 107 119 +M V30 126 1 108 120 +M V30 127 1 109 121 +M V30 128 1 110 122 +M V30 129 9 4 1 +M V30 130 9 34 1 +M V30 131 9 64 1 +M V30 132 9 94 1 +M V30 133 9 16 2 +M V30 134 9 46 2 +M V30 135 9 76 2 +M V30 136 9 106 2 +M V30 END BOND +M V30 END CTAB +M END + +$$$$ diff --git a/python/examples/data/stkbuilt.xyz b/python/examples/data/stkbuilt.xyz new file mode 100644 index 000000000..a2b2b77c1 --- /dev/null +++ b/python/examples/data/stkbuilt.xyz @@ -0,0 +1,460 @@ +170 +e='4249.823439159263' rg='8.064591581900297' +C -2.539265 -1.258652 5.264906 +C -1.272508 -0.533842 5.264920 +C -1.240002 0.852666 5.264915 +C -0.071293 1.564287 5.264912 +C -0.057058 3.022874 5.264906 +C 1.096753 0.849687 5.264916 +C 1.135644 -0.543578 5.264921 +C 2.410952 -1.249066 5.264906 +C -0.068498 -1.196303 5.264924 +H -2.519966 -2.331290 5.264926 +H -2.198207 1.366919 5.264910 +H 0.872513 3.566283 5.264909 +H 2.049556 1.387347 5.264918 +H 3.308020 -0.669524 5.264853 +H -0.071162 -2.278757 5.264932 +C -5.374833 -3.133525 1.121164 +C -4.956375 -2.885377 -0.254822 +C -4.155871 -3.790945 -0.934967 +C -3.745013 -3.590602 -2.224674 +C -2.902893 -4.554773 -2.923880 +C -4.157591 -2.439833 -2.841515 +C -4.961997 -1.488539 -2.216480 +C -5.369299 -0.281907 -2.925189 +C -5.338850 -1.748602 -0.925606 +H -5.994137 -2.407300 1.611047 +H -3.858962 -4.686998 -0.395016 +H -2.589158 -4.380359 -3.939037 +H -3.847174 -2.248173 -3.872932 +H -5.034656 -0.150320 -3.930823 +H -5.963812 -1.028507 -0.413160 +C 5.152678 -2.933720 0.908531 +C 4.728546 -2.695399 -0.467455 +C 5.112538 -1.549357 -1.147601 +C 4.733608 -1.293716 -2.437308 +C 5.147544 -0.082333 -3.136513 +C 3.943302 -2.226402 -3.054149 +C 3.521660 -3.398686 -2.429114 +C 2.680337 -4.354736 -3.137823 +C 3.935307 -3.595019 -1.138239 +H 4.833401 -3.833165 1.398413 +H 5.740089 -0.844200 -0.607649 +H 4.839630 0.102163 -4.151671 +H 3.622111 -2.053404 -4.085566 +H 2.399058 -4.130720 -4.143457 +H 3.624168 -4.496299 -0.625794 +C 0.277117 5.888956 0.743356 +C 0.282791 5.402487 -0.632630 +C -0.901706 5.162014 -1.312775 +C -0.933633 4.706030 -2.602482 +C -2.189689 4.458817 -3.301688 +C 0.269251 4.487948 -3.219323 +C 1.495299 4.708937 -2.594288 +C 2.743924 4.458354 -3.302997 +C 1.458505 5.165332 -1.303414 +H 1.215698 6.062177 1.233239 +H -1.826165 5.352910 -0.772824 +H -2.195510 4.099908 -4.316845 +H 0.280025 4.123289 -4.250740 +H 2.690560 4.102752 -4.308631 +H 2.394605 5.346518 -0.790968 +N -3.999495 -2.425341 5.223593 +C -5.415765 -2.815495 5.161259 +C -5.787157 -3.278124 6.552266 +C -7.061933 -4.059514 6.594534 +C -7.708727 -3.930169 5.211283 +C -6.793416 -4.717415 4.277598 +C -5.525603 -3.894586 4.133801 +N -5.475186 -3.277332 2.813798 +H -5.963621 -1.884023 4.874471 +H -4.966460 -3.945073 6.894586 +H -5.910867 -2.390962 7.199190 +H -6.865001 -5.155732 6.716028 +H -7.733194 -3.736703 7.395857 +H -8.705703 -4.380945 5.297076 +H -7.773831 -2.874231 4.926368 +H -6.484394 -5.662451 4.798149 +H -7.265322 -4.964195 3.328501 +H -4.607170 -4.542551 4.189235 +N 3.699332 -2.369059 5.240841 +C 4.745624 -3.400235 5.178578 +C 5.332126 -3.490167 6.569543 +C 6.646414 -4.203097 6.611804 +C 6.857832 -4.828082 5.228637 +C 7.081541 -3.641871 4.294733 +C 5.734844 -2.955714 4.150951 +N 5.175024 -3.221050 2.831046 +H 4.213101 -4.340620 4.891996 +H 5.499122 -2.445846 6.911674 +H 4.625886 -4.040968 7.216627 +H 7.497117 -3.484190 6.733098 +H 6.702760 -4.945684 7.413245 +H 7.746884 -5.465846 5.314450 +H 5.976045 -5.412718 4.943903 +H 7.745305 -2.901466 4.815099 +H 7.531198 -3.927199 3.345640 +H 5.836485 -1.836309 4.206190 +N -0.231290 4.731746 4.640969 +C 0.139258 6.153268 4.578579 +C -0.075362 6.706265 5.969619 +C -0.114349 8.200956 6.011893 +C 0.320960 8.696330 4.628576 +C -0.818699 8.297516 3.695064 +C -0.740362 6.788126 3.551255 +N -0.231290 6.435728 2.231175 +H 1.219823 6.161757 4.291626 +H -1.063334 6.329207 6.312089 +H 0.754824 6.369640 6.616416 +H -1.162067 8.578743 6.133547 +H 0.501057 8.620747 6.813122 +H 0.429312 9.785101 4.714351 +H 1.267836 8.224538 4.343516 +H -1.791511 8.502623 4.215764 +H -0.796493 8.829584 2.745964 +H -1.760826 6.316943 3.606845 +N -1.521851 -5.378862 -3.455668 +C -0.650193 -6.082881 -4.407769 +C -1.466699 -7.231016 -4.957277 +C -0.638255 -8.269686 -5.644484 +C 0.777222 -7.696466 -5.772138 +C 1.309176 -7.648984 -4.342422 +C 0.555149 -6.529935 -3.646543 +N 1.429533 -5.378862 -3.455668 +H -0.410995 -5.329142 -5.198147 +H -1.964019 -7.711781 -4.087171 +H -2.189157 -6.831951 -5.691902 +H -0.519470 -9.184004 -5.007971 +H -1.050090 -8.571625 -6.612030 +H 1.335789 -8.399982 -6.402685 +H 0.737584 -6.700729 -6.227505 +H 1.002445 -8.593010 -3.818692 +H 2.391303 -7.543481 -4.294970 +H 0.237722 -6.831527 -2.609850 +N -5.245782 1.408822 -3.680600 +C -5.790215 2.729654 -4.028337 +C -6.977649 2.472400 -4.928713 +C -7.423593 3.686470 -5.680096 +C -6.655211 4.877297 -5.097023 +C -5.207724 4.655838 -5.527204 +C -4.694363 3.488773 -4.702888 +N -3.770090 3.964795 -3.680600 +H -6.099376 3.184350 -3.054835 +H -6.653889 1.711221 -5.671231 +H -7.824138 2.126897 -4.308263 +H -7.107322 3.641032 -6.753941 +H -8.506709 3.836261 -5.643458 +H -7.093386 5.775255 -5.551109 +H -6.760516 4.892324 -4.006561 +H -5.204884 4.300015 -6.591602 +H -4.597546 5.553084 -5.443457 +H -4.093032 2.775062 -5.331751 +N 5.719316 1.464169 -4.042220 +C 5.893186 2.571056 -4.994321 +C 7.295753 2.438009 -5.543830 +C 7.781046 3.674797 -6.231037 +C 6.576884 4.614027 -6.358691 +C 6.269787 5.050972 -4.928975 +C 5.677675 3.838440 -4.233095 +N 4.243624 4.020142 -4.042220 +H 5.120830 2.401338 -5.784699 +H 7.960768 2.247699 -4.673723 +H 7.311382 1.612809 -6.278455 +H 8.513476 4.234827 -5.594524 +H 8.248450 3.469107 -7.198582 +H 6.906863 5.449517 -6.989237 +H 5.734370 4.081830 -6.814057 +H 7.240702 5.257347 -4.405244 +H 5.637355 5.935369 -4.881523 +H 6.097575 3.714337 -3.196402 +Br 1.187001 0.000000 0.000000 +Br -1.187001 0.000000 0.000000 +80 +e='69001.98212643963' rg='7.271655994630595' +C -1.213436 -0.700577 7.692133 +C 0.002427 0.019462 8.153242 +C 1.228923 -0.712778 7.692133 +C -0.015487 1.413355 7.692133 +H -1.410645 -0.866019 6.646722 +H 0.022807 0.032828 9.263985 +H 1.377876 -0.850759 6.615830 +H 0.769601 2.127094 7.909346 +C -6.685079 -3.859632 -1.243023 +C -6.645858 -3.855049 -2.728904 +C -6.692123 -2.441402 -3.231449 +C -5.464600 -4.577285 -3.217661 +H -5.927022 -3.370385 -0.655542 +H -7.545059 -4.375802 -3.122092 +H -5.892988 -1.756043 -2.929257 +H -5.229876 -4.702235 -4.267547 +C 6.685079 -3.859632 -1.243023 +C 6.661499 -3.827957 -2.728904 +C 5.460378 -4.574847 -3.231449 +C 6.696345 -2.443840 -3.217661 +H 5.882350 -3.447759 -0.655542 +H 7.562085 -4.346311 -3.122092 +H 4.467272 -4.225456 -2.929257 +H 6.687193 -2.178088 -4.267547 +C -0.000000 7.719264 -1.243023 +C -0.015641 7.683006 -2.728904 +C 1.231745 7.016250 -3.231449 +C -1.231745 7.021124 -3.217661 +H 0.044672 6.818144 -0.655542 +H -0.017027 8.722114 -3.122092 +H 1.425717 5.981499 -2.929257 +H -1.457317 6.880323 -4.267547 +N -3.217755 -1.857772 4.419093 +C -4.605053 -2.231333 4.442108 +C -4.928956 -3.207931 3.315232 +N -4.680760 -2.702438 2.030017 +H -5.247674 -1.330030 4.365139 +H -4.778399 -2.783091 5.391129 +H -4.238774 -4.083144 3.488397 +H -5.970227 -3.551659 3.421200 +N 3.225498 -1.863872 4.419093 +C 4.242450 -2.878739 4.442054 +C 5.250286 -2.671014 3.315278 +N 4.688503 -2.708538 2.030017 +H 3.783008 -3.885812 4.364924 +H 4.806916 -2.753218 5.391132 +H 5.663352 -1.635799 3.488604 +H 6.068440 -3.401099 3.421213 +N -0.007744 3.721644 4.419093 +C 0.360803 5.110277 4.442403 +C -0.322972 5.878312 3.314981 +N -0.007744 5.410976 2.030017 +H 1.462605 5.217398 4.366316 +H -0.031601 5.535835 5.391111 +H -1.425976 5.716955 3.487264 +H -0.101313 6.952194 3.421126 +N -1.465116 -4.576066 -3.224555 +C -0.682420 -5.300270 -4.187669 +C 0.681541 -5.675456 -3.615523 +N 1.460894 -4.576066 -3.224555 +H -0.558448 -4.699922 -5.112572 +H -1.211341 -6.257805 -4.383879 +H 0.447714 -6.285689 -2.696134 +H 1.214880 -6.313621 -4.337962 +N -4.693436 1.022862 -3.224555 +C -5.298547 2.276001 -3.582542 +C -4.259262 3.250937 -4.128338 +N -3.230432 3.556860 -3.224555 +H -5.815956 2.717878 -2.706034 +H -6.001998 2.071394 -4.418257 +H -3.804158 2.718182 -5.012300 +H -4.767701 4.160331 -4.486267 +N 4.695547 1.019206 -3.224555 +C 4.931379 2.059142 -4.187669 +C 4.574318 3.427960 -3.615523 +N 3.232542 3.553204 -3.224555 +H 4.349476 1.866331 -5.112572 +H 6.025088 2.079850 -4.383879 +H 5.219710 3.530576 -2.696134 +H 4.860316 4.208927 -4.337962 +80 +e='3541.3491046932395' rg='5.472767402726612' +C -1.255585 -0.422519 4.077182 +C -0.039723 0.297521 4.538291 +C 1.186773 -0.434719 4.077182 +C -0.057637 1.691414 4.077182 +H -1.452795 -0.587960 3.031771 +H -0.019343 0.310887 5.649034 +H 1.335727 -0.572700 3.000879 +H 0.727451 2.405153 4.294395 +C -3.749829 -1.780548 0.183890 +C -3.710608 -1.775965 -1.301990 +C -3.756873 -0.362318 -1.804536 +C -2.529350 -2.498201 -1.790748 +H -2.991772 -1.291301 0.771371 +H -4.609809 -2.296718 -1.695179 +H -2.957739 0.323041 -1.502343 +H -2.294626 -2.623151 -2.840634 +C 3.623250 -2.036431 -0.262952 +C 3.599671 -2.004756 -1.748833 +C 2.398549 -2.751646 -2.251378 +C 3.634516 -0.620638 -2.237590 +H 2.820522 -1.624557 0.324529 +H 4.500257 -2.523110 -2.142021 +H 1.405443 -2.402255 -1.949186 +H 3.625364 -0.354887 -3.287476 +C -0.165382 5.015399 -0.129381 +C -0.181023 4.979141 -1.615261 +C 1.066363 4.312384 -2.117807 +C -1.397127 4.317259 -2.104019 +H -0.120710 4.114278 0.458100 +H -0.182408 6.018248 -2.008450 +H 1.260335 3.277633 -1.815614 +H -1.622699 4.176457 -3.153905 +N -2.486978 -1.428420 4.102662 +C -3.874276 -1.801981 4.125677 +C -4.198179 -2.778579 2.998801 +N -3.949983 -2.273086 1.713586 +H -4.516897 -0.900678 4.048708 +H -4.047622 -2.353739 5.074698 +H -3.507997 -3.653792 3.171966 +H -5.239450 -3.122307 3.104769 +N 2.491408 -1.460608 3.681493 +C 3.508360 -2.475475 3.704454 +C 4.516195 -2.267750 2.577678 +N 3.954413 -2.305274 1.292416 +H 3.048917 -3.482548 3.627324 +H 4.072826 -2.349954 4.653532 +H 4.929261 -1.232535 2.751003 +H 5.334349 -2.997834 2.683613 +N -0.043150 3.558952 3.906022 +C 0.325396 4.947586 3.929332 +C -0.358378 5.715620 2.801910 +N -0.043150 5.248285 1.516945 +H 1.427199 5.054707 3.853244 +H -0.067007 5.373144 4.878040 +H -1.461383 5.554264 2.974192 +H -0.136720 6.789502 2.908055 +N -1.594724 -3.795798 -2.658274 +C -0.812029 -4.520003 -3.621388 +C 0.551933 -4.895188 -3.049242 +N 1.331285 -3.795798 -2.658274 +H -0.688057 -3.919654 -4.546291 +H -1.340950 -5.477537 -3.817598 +H 0.318105 -5.505422 -2.129853 +H 1.085271 -5.533353 -3.771680 +N -4.012942 0.808983 -2.769006 +C -4.618052 2.062123 -3.126994 +C -3.578767 3.037058 -3.672789 +N -2.549937 3.342982 -2.769006 +H -5.135461 2.503999 -2.250486 +H -5.321503 1.857515 -3.962709 +H -3.123663 2.504303 -4.556751 +H -4.087207 3.946453 -4.030719 +N 3.899485 1.167738 -2.733970 +C 4.135317 2.207675 -3.697084 +C 3.778256 3.576493 -3.124938 +N 2.436481 3.701737 -2.733970 +H 3.553414 2.014863 -4.621987 +H 5.229026 2.228383 -3.893294 +H 4.423648 3.679109 -2.205550 +H 4.064254 4.357460 -3.847377 +122 +e='361.28646712346455' rg='15.220721731729968' +Pd 0.000000 6.706139 0.000000 +Pd 0.000000 -6.706139 0.000000 +C 14.617151 4.788114 -0.606619 +N 13.412279 4.893306 -0.000000 +C 12.901820 3.799282 0.593223 +C 13.565877 2.587447 0.599618 +C 14.793916 2.474878 -0.017105 +C 15.493884 1.192641 -0.008968 +C 16.871077 1.129187 -0.007671 +C 17.556534 -0.083989 0.000424 +C 16.857801 -1.274026 0.007511 +C 15.478020 -1.242464 0.006411 +C 14.749705 -2.493615 0.014614 +C 13.522003 -2.591883 0.623452 +C 12.880642 -3.809551 0.596673 +N 13.412279 -4.893306 0.000000 +C 14.611776 -4.815506 -0.600290 +C 15.264750 -3.621907 -0.586634 +C 14.814107 -0.014410 -0.001813 +C 15.314784 3.598395 -0.624584 +H 14.994387 5.697699 -1.075037 +H 11.924946 3.831871 1.100866 +H 13.163007 1.699657 1.074149 +H 17.434224 2.059040 -0.013178 +H 18.634873 -0.106053 0.001236 +H 17.372346 -2.236272 0.013913 +H 13.043071 -1.745509 1.122496 +H 11.901981 -3.902911 1.077175 +H 15.031603 -5.708122 -1.081966 +H 16.239128 -3.598600 -1.085790 +H 13.746032 0.012568 -0.002636 +H 16.263366 3.574652 -1.119470 +C 0.606619 4.788114 14.617151 +N 0.000000 4.893306 13.412279 +C -0.593223 3.799282 12.901820 +C -0.599618 2.587447 13.565877 +C 0.017105 2.474878 14.793916 +C 0.008968 1.192641 15.493884 +C 0.007671 1.129187 16.871077 +C -0.000424 -0.083989 17.556534 +C -0.007511 -1.274026 16.857801 +C -0.006411 -1.242464 15.478020 +C -0.014614 -2.493615 14.749705 +C -0.623452 -2.591883 13.522003 +C -0.596673 -3.809551 12.880642 +N 0.000000 -4.893306 13.412279 +C 0.600290 -4.815506 14.611776 +C 0.586634 -3.621907 15.264750 +C 0.001813 -0.014410 14.814107 +C 0.624584 3.598395 15.314784 +H 1.075037 5.697699 14.994387 +H -1.100866 3.831871 11.924946 +H -1.074149 1.699657 13.163007 +H 0.013178 2.059040 17.434224 +H -0.001236 -0.106053 18.634873 +H -0.013913 -2.236272 17.372346 +H -1.122496 -1.745509 13.043071 +H -1.077175 -3.902911 11.901981 +H 1.081966 -5.708122 15.031603 +H 1.085790 -3.598600 16.239128 +H 0.002636 0.012568 13.746032 +H 1.119470 3.574652 16.263366 +C -14.617151 4.788114 0.606619 +N -13.412279 4.893306 0.000000 +C -12.901820 3.799282 -0.593223 +C -13.565877 2.587447 -0.599618 +C -14.793916 2.474878 0.017105 +C -15.493884 1.192641 0.008968 +C -16.871077 1.129187 0.007671 +C -17.556534 -0.083989 -0.000424 +C -16.857801 -1.274026 -0.007511 +C -15.478020 -1.242464 -0.006411 +C -14.749705 -2.493615 -0.014614 +C -13.522003 -2.591883 -0.623452 +C -12.880642 -3.809551 -0.596673 +N -13.412279 -4.893306 -0.000000 +C -14.611776 -4.815506 0.600290 +C -15.264750 -3.621907 0.586634 +C -14.814107 -0.014410 0.001813 +C -15.314784 3.598395 0.624584 +H -14.994387 5.697699 1.075037 +H -11.924946 3.831871 -1.100866 +H -13.163007 1.699657 -1.074149 +H -17.434224 2.059040 0.013178 +H -18.634873 -0.106053 -0.001236 +H -17.372346 -2.236272 -0.013913 +H -13.043071 -1.745509 -1.122496 +H -11.901981 -3.902911 -1.077175 +H -15.031603 -5.708122 1.081966 +H -16.239128 -3.598600 1.085790 +H -13.746032 0.012568 0.002636 +H -16.263366 3.574652 1.119470 +C -0.606619 4.788114 -14.617151 +N -0.000000 4.893306 -13.412279 +C 0.593223 3.799282 -12.901820 +C 0.599618 2.587447 -13.565877 +C -0.017105 2.474878 -14.793916 +C -0.008968 1.192641 -15.493884 +C -0.007671 1.129187 -16.871077 +C 0.000424 -0.083989 -17.556534 +C 0.007511 -1.274026 -16.857801 +C 0.006411 -1.242464 -15.478020 +C 0.014614 -2.493615 -14.749705 +C 0.623452 -2.591883 -13.522003 +C 0.596673 -3.809551 -12.880642 +N -0.000000 -4.893306 -13.412279 +C -0.600290 -4.815506 -14.611776 +C -0.586634 -3.621907 -15.264750 +C -0.001813 -0.014410 -14.814107 +C -0.624584 3.598395 -15.314784 +H -1.075037 5.697699 -14.994387 +H 1.100866 3.831871 -11.924946 +H 1.074149 1.699657 -13.163007 +H -0.013178 2.059040 -17.434224 +H 0.001236 -0.106053 -18.634873 +H 0.013913 -2.236272 -17.372346 +H 1.122496 -1.745509 -13.043071 +H 1.077175 -3.902911 -11.901981 +H -1.081966 -5.708122 -15.031603 +H -1.085790 -3.598600 -16.239128 +H -0.002636 0.012568 -13.746032 +H -1.119470 3.574652 -16.263366 diff --git a/python/examples/data/unoptcage.mol b/python/examples/data/unoptcage.mol new file mode 100644 index 000000000..d61446e47 --- /dev/null +++ b/python/examples/data/unoptcage.mol @@ -0,0 +1,176 @@ + + RDKit 3D + + 0 0 0 0 0 0 0 0 0 0999 V3000 +M V30 BEGIN CTAB +M V30 COUNTS 80 82 0 0 0 +M V30 BEGIN ATOM +M V30 1 C -1.2134 -0.7006 7.6921 0 +M V30 2 C 0.0024 0.0195 8.1532 0 +M V30 3 C 1.2289 -0.7128 7.6921 0 +M V30 4 C -0.0155 1.4134 7.6921 0 +M V30 5 H -1.4106 -0.8660 6.6467 0 +M V30 6 H 0.0228 0.0328 9.2640 0 +M V30 7 H 1.3779 -0.8508 6.6158 0 +M V30 8 H 0.7696 2.1271 7.9093 0 +M V30 9 C -6.6851 -3.8596 -1.2430 0 +M V30 10 C -6.6459 -3.8550 -2.7289 0 +M V30 11 C -6.6921 -2.4414 -3.2314 0 +M V30 12 C -5.4646 -4.5773 -3.2177 0 +M V30 13 H -5.9270 -3.3704 -0.6555 0 +M V30 14 H -7.5451 -4.3758 -3.1221 0 +M V30 15 H -5.8930 -1.7560 -2.9293 0 +M V30 16 H -5.2299 -4.7022 -4.2675 0 +M V30 17 C 6.6851 -3.8596 -1.2430 0 +M V30 18 C 6.6615 -3.8280 -2.7289 0 +M V30 19 C 5.4604 -4.5748 -3.2314 0 +M V30 20 C 6.6963 -2.4438 -3.2177 0 +M V30 21 H 5.8824 -3.4478 -0.6555 0 +M V30 22 H 7.5621 -4.3463 -3.1221 0 +M V30 23 H 4.4673 -4.2255 -2.9293 0 +M V30 24 H 6.6872 -2.1781 -4.2675 0 +M V30 25 C -0.0000 7.7193 -1.2430 0 +M V30 26 C -0.0156 7.6830 -2.7289 0 +M V30 27 C 1.2317 7.0162 -3.2314 0 +M V30 28 C -1.2317 7.0211 -3.2177 0 +M V30 29 H 0.0447 6.8181 -0.6555 0 +M V30 30 H -0.0170 8.7221 -3.1221 0 +M V30 31 H 1.4257 5.9815 -2.9293 0 +M V30 32 H -1.4573 6.8803 -4.2675 0 +M V30 33 N -3.2178 -1.8578 4.4191 0 +M V30 34 C -4.6051 -2.2313 4.4421 0 +M V30 35 C -4.9290 -3.2079 3.3152 0 +M V30 36 N -4.6808 -2.7024 2.0300 0 +M V30 37 H -5.2477 -1.3300 4.3651 0 +M V30 38 H -4.7784 -2.7831 5.3911 0 +M V30 39 H -4.2388 -4.0831 3.4884 0 +M V30 40 H -5.9702 -3.5517 3.4212 0 +M V30 41 N 3.2255 -1.8639 4.4191 0 +M V30 42 C 4.2425 -2.8787 4.4421 0 +M V30 43 C 5.2503 -2.6710 3.3153 0 +M V30 44 N 4.6885 -2.7085 2.0300 0 +M V30 45 H 3.7830 -3.8858 4.3649 0 +M V30 46 H 4.8069 -2.7532 5.3911 0 +M V30 47 H 5.6634 -1.6358 3.4886 0 +M V30 48 H 6.0684 -3.4011 3.4212 0 +M V30 49 N -0.0077 3.7216 4.4191 0 +M V30 50 C 0.3608 5.1103 4.4424 0 +M V30 51 C -0.3230 5.8783 3.3150 0 +M V30 52 N -0.0077 5.4110 2.0300 0 +M V30 53 H 1.4626 5.2174 4.3663 0 +M V30 54 H -0.0316 5.5358 5.3911 0 +M V30 55 H -1.4260 5.7170 3.4873 0 +M V30 56 H -0.1013 6.9522 3.4211 0 +M V30 57 N -1.4651 -4.5761 -3.2246 0 +M V30 58 C -0.6824 -5.3003 -4.1877 0 +M V30 59 C 0.6815 -5.6755 -3.6155 0 +M V30 60 N 1.4609 -4.5761 -3.2246 0 +M V30 61 H -0.5584 -4.6999 -5.1126 0 +M V30 62 H -1.2113 -6.2578 -4.3839 0 +M V30 63 H 0.4477 -6.2857 -2.6961 0 +M V30 64 H 1.2149 -6.3136 -4.3380 0 +M V30 65 N -4.6934 1.0229 -3.2246 0 +M V30 66 C -5.2985 2.2760 -3.5825 0 +M V30 67 C -4.2593 3.2509 -4.1283 0 +M V30 68 N -3.2304 3.5569 -3.2246 0 +M V30 69 H -5.8160 2.7179 -2.7060 0 +M V30 70 H -6.0020 2.0714 -4.4183 0 +M V30 71 H -3.8042 2.7182 -5.0123 0 +M V30 72 H -4.7677 4.1603 -4.4863 0 +M V30 73 N 4.6955 1.0192 -3.2246 0 +M V30 74 C 4.9314 2.0591 -4.1877 0 +M V30 75 C 4.5743 3.4280 -3.6155 0 +M V30 76 N 3.2325 3.5532 -3.2246 0 +M V30 77 H 4.3495 1.8663 -5.1126 0 +M V30 78 H 6.0251 2.0799 -4.3839 0 +M V30 79 H 5.2197 3.5306 -2.6961 0 +M V30 80 H 4.8603 4.2089 -4.3380 0 +M V30 END ATOM +M V30 BEGIN BOND +M V30 1 1 1 2 +M V30 2 1 2 3 +M V30 3 1 2 4 +M V30 4 1 1 5 +M V30 5 1 2 6 +M V30 6 1 3 7 +M V30 7 1 4 8 +M V30 8 1 9 10 +M V30 9 1 10 11 +M V30 10 1 10 12 +M V30 11 1 9 13 +M V30 12 1 10 14 +M V30 13 1 11 15 +M V30 14 1 12 16 +M V30 15 1 17 18 +M V30 16 1 18 19 +M V30 17 1 18 20 +M V30 18 1 17 21 +M V30 19 1 18 22 +M V30 20 1 19 23 +M V30 21 1 20 24 +M V30 22 1 25 26 +M V30 23 1 26 27 +M V30 24 1 26 28 +M V30 25 1 25 29 +M V30 26 1 26 30 +M V30 27 1 27 31 +M V30 28 1 28 32 +M V30 29 1 33 34 +M V30 30 1 34 35 +M V30 31 1 35 36 +M V30 32 1 34 37 +M V30 33 1 34 38 +M V30 34 1 35 39 +M V30 35 1 35 40 +M V30 36 1 41 42 +M V30 37 1 42 43 +M V30 38 1 43 44 +M V30 39 1 42 45 +M V30 40 1 42 46 +M V30 41 1 43 47 +M V30 42 1 43 48 +M V30 43 1 49 50 +M V30 44 1 50 51 +M V30 45 1 51 52 +M V30 46 1 50 53 +M V30 47 1 50 54 +M V30 48 1 51 55 +M V30 49 1 51 56 +M V30 50 1 57 58 +M V30 51 1 58 59 +M V30 52 1 59 60 +M V30 53 1 58 61 +M V30 54 1 58 62 +M V30 55 1 59 63 +M V30 56 1 59 64 +M V30 57 1 65 66 +M V30 58 1 66 67 +M V30 59 1 67 68 +M V30 60 1 66 69 +M V30 61 1 66 70 +M V30 62 1 67 71 +M V30 63 1 67 72 +M V30 64 1 73 74 +M V30 65 1 74 75 +M V30 66 1 75 76 +M V30 67 1 74 77 +M V30 68 1 74 78 +M V30 69 1 75 79 +M V30 70 1 75 80 +M V30 71 2 1 33 +M V30 72 2 9 36 +M V30 73 2 3 41 +M V30 74 2 17 44 +M V30 75 2 4 49 +M V30 76 2 25 52 +M V30 77 2 12 57 +M V30 78 2 19 60 +M V30 79 2 11 65 +M V30 80 2 28 68 +M V30 81 2 20 73 +M V30 82 2 27 76 +M V30 END BOND +M V30 END CTAB +M END + +$$$$ From 0f572e9f428049a68a23e57e0e7b12e3ee150350 Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Tue, 24 Sep 2024 17:22:11 +0200 Subject: [PATCH 04/35] Add dependancy for tests. --- tox.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tox.ini b/tox.ini index 86749e9e1..a3099cbfb 100644 --- a/tox.ini +++ b/tox.ini @@ -27,6 +27,8 @@ commands = description = Run Python unit tests deps = ase==3.22.1 + rdkit==2024.3.4 + stk commands = pip install chemiscope[explore] From bb7eb925f053d41f379177892ef50ad4579c9a44 Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Tue, 24 Sep 2024 17:23:35 +0200 Subject: [PATCH 05/35] Add example to README. --- python/README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/python/README.md b/python/README.md index 7a7fd5d58..ddd6ae200 100644 --- a/python/README.md +++ b/python/README.md @@ -53,3 +53,35 @@ properties = { chemiscope.show(frames=frames, properties=properties) ``` + +To create a new chemiscope input file using `stk`_: + +.. _`stk`: https://github.com/lukasturcani/stk + +`stk` is an optional dependancy: + +```bash +pip install stk +``` + +```python +import chemiscope +import stk + +# read frames using ase +frames = [stk.BuildingBlock(smiles="NCCN")] + +# add additional properties to display +properties = { + "": { + target: "atom", + values: [3, 4, 2, 8, 9, 10], + } +} + +chemiscope.write_input( + "my-input.json.gz", + frames=frames, + properties=properties, +) +``` \ No newline at end of file From 52ceea155ab6df1cf1ff8411e01c400fb15707ba Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Tue, 24 Sep 2024 17:25:14 +0200 Subject: [PATCH 06/35] Move function. --- python/chemiscope/__init__.py | 2 +- python/chemiscope/structures/__init__.py | 4 +- .../structures/{_bonding.py => _stk.py} | 43 +++++++++++-------- 3 files changed, 28 insertions(+), 21 deletions(-) rename python/chemiscope/structures/{_bonding.py => _stk.py} (74%) diff --git a/python/chemiscope/__init__.py b/python/chemiscope/__init__.py index 4a137f8d5..c275c6bcd 100644 --- a/python/chemiscope/__init__.py +++ b/python/chemiscope/__init__.py @@ -10,7 +10,7 @@ ellipsoid_from_tensor, extract_properties, librascal_atomic_environments, - convert_bonds_as_shapes, + convert_stk_bonds_as_shapes, ) from .explore import explore, metatensor_featurizer # noqa: F401 from .version import __version__ # noqa: F401 diff --git a/python/chemiscope/structures/__init__.py b/python/chemiscope/structures/__init__.py index 165b594ac..ca8041ee9 100644 --- a/python/chemiscope/structures/__init__.py +++ b/python/chemiscope/structures/__init__.py @@ -14,7 +14,7 @@ center_shape, ellipsoid_from_tensor, ) -from ._bonding import convert_bonds_as_shapes # noqa: F401 + from ._ase import ( # noqa: F401 ase_merge_pi_frames, ase_tensors_to_ellipsoids, @@ -22,7 +22,7 @@ ) __all__ = [ - "convert_bonds_as_shapes", + "convert_stk_bonds_as_shapes", ] diff --git a/python/chemiscope/structures/_bonding.py b/python/chemiscope/structures/_stk.py similarity index 74% rename from python/chemiscope/structures/_bonding.py rename to python/chemiscope/structures/_stk.py index cbe2cd33d..a406dd537 100644 --- a/python/chemiscope/structures/_bonding.py +++ b/python/chemiscope/structures/_stk.py @@ -1,40 +1,47 @@ -"""Module for handling bonding in chemiscope.""" try: - import ase + import stk - HAVE_ASE = True + HAVE_STK = True except ImportError: - HAVE_ASE = False + HAVE_STK = False -def convert_bonds_as_shapes( - frames: list[ase.Atoms], - bonds_per_frames: dict[int, list[tuple[int, int]]], +def convert_stk_bonds_as_shapes( + frames: list[stk.Molecule], + bond_color: str, + bond_radius: float, ) -> dict[str, dict]: """Convert connections between atom ids in each structure to shapes. Parameters: frames: - List of ase.Atoms object, which each are an molecule in chemiscope. + List of stk.Molecule objects, which each are structures in + chemiscope. + + bond_colour: + How to colour the bonds added. + + bond_radius: + Radius of bonds to add. - bonds_per_frames: - The bonds you want to add between atoms with the given ids. The key - to the dictionary should align with the id of the molecule in - frames. """ + shape_dict: dict[str, dict] = {} max_length = 0 - for fid, molecule in enumerate(frames): - bonds_to_add = bonds_per_frames[fid] + for molecule in frames: + bonds_to_add = tuple( + (bond.get_atom1().get_id(), bond.get_atom2().get_id()) + for bond in molecule.get_bonds() + ) for bid, bond_info in enumerate(bonds_to_add): bname = f"bond_{bid}" # Compute the bond vector. - position_matrix = molecule.get_positions() + position_matrix = molecule.get_position_matrix() bond_geometry = { "vector": ( position_matrix[bond_info[1]] - position_matrix[bond_info[0]] @@ -48,7 +55,7 @@ def convert_bonds_as_shapes( shape_dict[bname] = { "kind": "cylinder", "parameters": { - "global": {"radius": 0.12, "color": "#fc5500"}, + "global": {"radius": bond_radius, "color": bond_color}, "structure": [], }, } @@ -58,7 +65,7 @@ def convert_bonds_as_shapes( shape_dict[bname] = { "kind": "cylinder", "parameters": { - "global": {"radius": 0.12, "color": "#fc5500"}, + "global": {"radius": bond_radius, "color": bond_color}, # Add zero placements for previously non-existant # bond shapes up to the length of bond_0 -1, # because that should already be at the current @@ -81,7 +88,7 @@ def convert_bonds_as_shapes( missing = max_length - len(shape_dict[bname]["parameters"]["structure"]) if missing == 0: continue - for i in range(missing): + for _ in range(missing): fake_bond = {"vector": [0, 0, 0], "position": [0, 0, 0]} shape_dict[bname]["parameters"]["structure"].append(fake_bond) From cb1ef9154c6999f3122d9e3175c1c5bef2e20c2d Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Tue, 24 Sep 2024 17:26:00 +0200 Subject: [PATCH 07/35] Update example function. --- python/examples/8-showing_custom_bonds.py | 316 +++++++-------- python/examples/data/metalcage.mol | 272 ------------- python/examples/data/stkbuilt.xyz | 460 ---------------------- python/examples/data/unoptcage.mol | 176 --------- 4 files changed, 151 insertions(+), 1073 deletions(-) delete mode 100644 python/examples/data/metalcage.mol delete mode 100644 python/examples/data/stkbuilt.xyz delete mode 100644 python/examples/data/unoptcage.mol diff --git a/python/examples/8-showing_custom_bonds.py b/python/examples/8-showing_custom_bonds.py index 19f2b3e70..c806d9e7a 100644 --- a/python/examples/8-showing_custom_bonds.py +++ b/python/examples/8-showing_custom_bonds.py @@ -1,173 +1,180 @@ """ -Showing custom bonds -==================== +Showing custom bonds using stk +============================== This example demonstrates how to add shapes into the chemiscope output such that custom bonds that would not normally be assigned by ASE can be rendered. +This is done by using stk to generate and analyse molecules, which comes with +topology/bonding information by default (using the cheminformatic software +rdkit). + """ -# %% -# +import pathlib + import stk import stko -import ase.io -import pathlib +from rdkit.Chem import AllChem as rdkit + import chemiscope working_path = pathlib.Path(__file__).resolve().parent data_path = working_path / "data" -######################################################################## -# This is just for development, where I build the library of structures. -energy = stko.UFFEnergy() -analyser = stko.molecule_analysis.GeometryAnalyser() -xyz_path = data_path / "stkbuilt.xyz" -string = "" - -host = stk.ConstructedMolecule( - topology_graph=stk.cage.FourPlusSix( - building_blocks=( - stk.BuildingBlock( - smiles="NC1CCCCC1N", - functional_groups=[ - stk.PrimaryAminoFactory(), - ], - ), - stk.BuildingBlock( - smiles="O=Cc1cc(C=O)cc(C=O)c1", - functional_groups=[stk.AldehydeFactory()], +# %% +# +# Generate a list of stk BuildingBlocks (representation of a molecule) with +# properties. This also includes working with rdkit, which comes installed +# with stk. + +rdkitmol = rdkit.MolFromSmiles("Cc1ccccc1") +rdkitmol = rdkit.AddHs(rdkitmol) +rdkit.Kekulize(rdkitmol) +params = rdkit.ETKDGv3() +params.randomSeed = 0xF00D +rdkit.EmbedMolecule(rdkitmol, params) + +structures = [ + # A building block. + stk.BuildingBlock(smiles="NCCN"), + # A mostly optimised cage molecule. + stk.ConstructedMolecule( + topology_graph=stk.cage.FourPlusSix( + building_blocks=( + stk.BuildingBlock( + smiles="NCCN", + functional_groups=[stk.PrimaryAminoFactory()], + ), + stk.BuildingBlock( + smiles="O=CC(C=O)C=O", + functional_groups=[stk.AldehydeFactory()], + ), ), + optimizer=stk.MCHammer(), ), - optimizer=stk.MCHammer(), ), -) -molecule = stk.ConstructedMolecule( - topology_graph=stk.host_guest.Complex( - host=stk.BuildingBlock.init_from_molecule(host), - guests=stk.host_guest.Guest( - building_block=stk.BuildingBlock("[Br][Br]"), + # A metal-organic cage. + stk.ConstructedMolecule( + stk.cage.M2L4Lantern( + building_blocks=( + stk.BuildingBlock( + smiles="[Pd+2]", + functional_groups=( + stk.SingleAtom(stk.Pd(0, charge=2)) for i in range(4) + ), + position_matrix=[[0.0, 0.0, 0.0]], + ), + stk.BuildingBlock( + smiles=("C1=NC=CC(C2=CC=CC(C3=C" "C=NC=C3)=C2)=C1"), + functional_groups=[ + stk.SmartsFunctionalGroupFactory( + smarts="[#6]~[#7X2]~[#6]", + bonders=(1,), + deleters=(), + ), + ], + ), + ), + # Ensure that bonds between the + # GenericFunctionalGroups of the ligand and the + # SingleAtom functional groups of the metal are + # dative. + reaction_factory=stk.DativeReactionFactory( + stk.GenericReactionFactory( + bond_orders={ + frozenset( + { + stk.GenericFunctionalGroup, + stk.SingleAtom, + } + ): 9, + }, + ), + ), ), ), -) -teststring = stk.XyzWriter().to_string(molecule) -teststring = teststring.split("\n") -teststring[1] = ( - f"e='{energy.get_energy(molecule)}' " - f"rg='{analyser.get_radius_gyration(molecule)}'" -) -string += "\n".join(teststring) - -bb1 = stk.BuildingBlock( - smiles="NCCN", - functional_groups=[stk.PrimaryAminoFactory()], -) -bb2 = stk.BuildingBlock( - smiles="O=CC(C=O)C=O", - functional_groups=[stk.AldehydeFactory()], -) -molecule = stk.ConstructedMolecule( - topology_graph=stk.cage.FourPlusSix((bb1, bb2)), -) -molecule.write(data_path / "unoptcage.mol") -teststring = stk.XyzWriter().to_string(molecule) -teststring = teststring.split("\n") -teststring[1] = ( - f"e='{energy.get_energy(molecule)}' " - f"rg='{analyser.get_radius_gyration(molecule)}'" -) -string += "\n".join(teststring) - -molecule = stk.ConstructedMolecule( - topology_graph=stk.cage.FourPlusSix( - building_blocks=(bb1, bb2), - optimizer=stk.MCHammer(), - ) -) -teststring = stk.XyzWriter().to_string(molecule) -teststring = teststring.split("\n") -teststring[1] = ( - f"e='{energy.get_energy(molecule)}' " - f"rg='{analyser.get_radius_gyration(molecule)}'" -) -string += "\n".join(teststring) - - -palladium_atom = stk.BuildingBlock( - smiles="[Pd+2]", - functional_groups=(stk.SingleAtom(stk.Pd(0, charge=2)) for i in range(4)), - position_matrix=[[0.0, 0.0, 0.0]], -) -bb1 = stk.BuildingBlock( - smiles=("C1=NC=CC(C2=CC=CC(C3=C" "C=NC=C3)=C2)=C1"), - functional_groups=[ - stk.SmartsFunctionalGroupFactory( - smarts="[#6]~[#7X2]~[#6]", - bonders=(1,), - deleters=(), - ), - ], -) -molecule = stk.ConstructedMolecule( - stk.cage.M2L4Lantern( - building_blocks=(palladium_atom, bb1), - # Ensure that bonds between the - # GenericFunctionalGroups of the ligand and the - # SingleAtom functional groups of the metal are - # dative. - reaction_factory=stk.DativeReactionFactory( - stk.GenericReactionFactory( - bond_orders={ - frozenset( - { - stk.GenericFunctionalGroup, - stk.SingleAtom, - } - ): 9, - }, + # A host guest molecule. + stk.ConstructedMolecule( + topology_graph=stk.host_guest.Complex( + host=stk.BuildingBlock.init_from_molecule( + stk.ConstructedMolecule( + topology_graph=stk.cage.FourPlusSix( + building_blocks=( + stk.BuildingBlock( + smiles="NC1CCCCC1N", + functional_groups=[ + stk.PrimaryAminoFactory(), + ], + ), + stk.BuildingBlock( + smiles="O=Cc1cc(C=O)cc(C=O)c1", + functional_groups=[stk.AldehydeFactory()], + ), + ), + optimizer=stk.MCHammer(), + ), + ) + ), + guests=stk.host_guest.Guest( + building_block=stk.BuildingBlock("[Br][Br]"), ), ), ), -) -molecule.write(data_path / "metalcage.mol") -teststring = stk.XyzWriter().to_string(molecule) -teststring = teststring.split("\n") -teststring[1] = ( - f"e='{energy.get_energy(molecule)}' " - f"rg='{analyser.get_radius_gyration(molecule)}'" -) -string += "\n".join(teststring) + # From rdkit. + stk.BuildingBlock.init_from_rdkit_mol(rdkitmol), +] +# Write to file for sanity checks. +for i, struct in enumerate(structures): + struct.write(data_path / f"stk_{i}.mol") -with xyz_path.open("w") as f: - f.write(string) +# %% +# +# Write their properties using any method, here we show using stko: +# https://stko-docs.readthedocs.io/en/latest/ -######################################################################## +energy = stko.UFFEnergy() +analyser = stko.molecule_analysis.GeometryAnalyser() +properties = { + "e": [energy.get_energy(molecule) for molecule in structures], + "rg": [analyser.get_radius_gyration(molecule) for molecule in structures], +} -print( - "one change I am interested in, is if you want to use the standard " - "load xyz > chemiscope workflow, like here. " - "or, if I use rdkit/stk to provide the graph automatically? " - "I would not want to add any dependancies in doing so" +# %% +# +# Get the stk bonding information and convert them into shapes. +shape_dict = chemiscope.convert_stk_bonds_as_shapes( + frames=structures, + bond_color="#fc5500", + bond_radius=0.12, ) +# Write the shape string for settings to turn them on automatically. +shape_string = ",".join(shape_dict.keys()) + # %% # -# Load structures from an extended xyz file. -frames = ase.io.read(xyz_path, ":") +# A chemiscope widget can be used to visualize structures and properties. +# This generates a Chemiscope object that is rendered to an interactive +# widget when executed in a Jupyter notebook. + +chemiscope.show(frames=structures, properties=properties) # %% # -# Write to json file without added shapes and note that the XX-XX bonds are -# missing. +# For sharing with collaborators, or when one does not want to use an interactive +# notebook, one can also write a JSON (or compressed JSON) file that contains all +# information about structures and properties, and can be viewed at chemiscope.org +# Save as a file that can be viewed at chemiscope.org chemiscope.write_input( - "noshape_example.json.gz", - frames=frames, - properties=chemiscope.extract_properties(frames, only=["e", "rg"]), + path="noshape_example.json.gz", + frames=structures, + properties=properties, meta=dict(name="Missing bonds by automation."), settings=chemiscope.quick_settings(x="rg", y="e", color=""), ) @@ -175,44 +182,22 @@ # %% # -# Compute the shape dicionary from the structures based on XX. -mol1 = stk.BuildingBlock.init_from_file(data_path / "unoptcage.mol") -mol1_bonds = tuple( - (bond.get_atom1().get_id(), bond.get_atom2().get_id()) for bond in mol1.get_bonds() -) +# Now with added bonding information. -mol3 = stk.BuildingBlock.init_from_file(data_path / "metalcage.mol") -mol3_bonds = tuple( - (bond.get_atom1().get_id(), bond.get_atom2().get_id()) for bond in mol3.get_bonds() -) -bonds_per_frames = { - # Here, we do it by hand to fill in some issues. - 0: ((0, 60), (22, 132), (30, 85), (34, 150), (4, 96), (46, 169)), - 2: ((3, 48), (11, 56), (19, 72)), - # In these two examples, we are using "fake", unoptimised models and show - # how to generate these from a mol file. - # Although these examples currently require a new dependancy, so I can - # alter them as needed? - 1: mol1_bonds, - 3: mol3_bonds, -} - -shape_dict = chemiscope.convert_bonds_as_shapes( - frames=frames, - bonds_per_frames=bonds_per_frames, +chemiscope.show( + frames=structures, + properties=properties, + shapes=shape_dict, ) -# Write the shape string for settings to turn them on automatically. -shape_string = ",".join(shape_dict.keys()) # %% # -# Write to json file with added shapes and note that the XX-XX bonds are -# present. +# Write to json file with added shapes and note are present. chemiscope.write_input( - "shape_example.json.gz", - frames=frames, - properties=chemiscope.extract_properties(frames, only=["e", "rg"]), - meta=dict(name="Added some bonds."), + path="shape_example.json.gz", + frames=structures, + properties=properties, + meta=dict(name="Added all stk bonds."), settings=chemiscope.quick_settings( x="rg", y="e", @@ -220,11 +205,12 @@ structure_settings={ "shape": shape_string, "atoms": True, - "bonds": True, + "bonds": False, "spaceFilling": False, }, ), shapes=shape_dict, ) + raise SystemExit diff --git a/python/examples/data/metalcage.mol b/python/examples/data/metalcage.mol deleted file mode 100644 index f0dfe7c02..000000000 --- a/python/examples/data/metalcage.mol +++ /dev/null @@ -1,272 +0,0 @@ - - RDKit 3D - - 0 0 0 0 0 0 0 0 0 0999 V3000 -M V30 BEGIN CTAB -M V30 COUNTS 122 136 0 0 0 -M V30 BEGIN ATOM -M V30 1 Pd 0.0000 6.7061 0.0000 0 CHG=2 -M V30 2 Pd 0.0000 -6.7061 0.0000 0 CHG=2 -M V30 3 C 14.6172 4.7881 -0.6066 0 -M V30 4 N 13.4123 4.8933 -0.0000 0 -M V30 5 C 12.9018 3.7993 0.5932 0 -M V30 6 C 13.5659 2.5874 0.5996 0 -M V30 7 C 14.7939 2.4749 -0.0171 0 -M V30 8 C 15.4939 1.1926 -0.0090 0 -M V30 9 C 16.8711 1.1292 -0.0077 0 -M V30 10 C 17.5565 -0.0840 0.0004 0 -M V30 11 C 16.8578 -1.2740 0.0075 0 -M V30 12 C 15.4780 -1.2425 0.0064 0 -M V30 13 C 14.7497 -2.4936 0.0146 0 -M V30 14 C 13.5220 -2.5919 0.6235 0 -M V30 15 C 12.8806 -3.8096 0.5967 0 -M V30 16 N 13.4123 -4.8933 0.0000 0 -M V30 17 C 14.6118 -4.8155 -0.6003 0 -M V30 18 C 15.2647 -3.6219 -0.5866 0 -M V30 19 C 14.8141 -0.0144 -0.0018 0 -M V30 20 C 15.3148 3.5984 -0.6246 0 -M V30 21 H 14.9944 5.6977 -1.0750 0 -M V30 22 H 11.9249 3.8319 1.1009 0 -M V30 23 H 13.1630 1.6997 1.0741 0 -M V30 24 H 17.4342 2.0590 -0.0132 0 -M V30 25 H 18.6349 -0.1061 0.0012 0 -M V30 26 H 17.3723 -2.2363 0.0139 0 -M V30 27 H 13.0431 -1.7455 1.1225 0 -M V30 28 H 11.9020 -3.9029 1.0772 0 -M V30 29 H 15.0316 -5.7081 -1.0820 0 -M V30 30 H 16.2391 -3.5986 -1.0858 0 -M V30 31 H 13.7460 0.0126 -0.0026 0 -M V30 32 H 16.2634 3.5747 -1.1195 0 -M V30 33 C 0.6066 4.7881 14.6172 0 -M V30 34 N 0.0000 4.8933 13.4123 0 -M V30 35 C -0.5932 3.7993 12.9018 0 -M V30 36 C -0.5996 2.5874 13.5659 0 -M V30 37 C 0.0171 2.4749 14.7939 0 -M V30 38 C 0.0090 1.1926 15.4939 0 -M V30 39 C 0.0077 1.1292 16.8711 0 -M V30 40 C -0.0004 -0.0840 17.5565 0 -M V30 41 C -0.0075 -1.2740 16.8578 0 -M V30 42 C -0.0064 -1.2425 15.4780 0 -M V30 43 C -0.0146 -2.4936 14.7497 0 -M V30 44 C -0.6235 -2.5919 13.5220 0 -M V30 45 C -0.5967 -3.8096 12.8806 0 -M V30 46 N 0.0000 -4.8933 13.4123 0 -M V30 47 C 0.6003 -4.8155 14.6118 0 -M V30 48 C 0.5866 -3.6219 15.2647 0 -M V30 49 C 0.0018 -0.0144 14.8141 0 -M V30 50 C 0.6246 3.5984 15.3148 0 -M V30 51 H 1.0750 5.6977 14.9944 0 -M V30 52 H -1.1009 3.8319 11.9249 0 -M V30 53 H -1.0741 1.6997 13.1630 0 -M V30 54 H 0.0132 2.0590 17.4342 0 -M V30 55 H -0.0012 -0.1061 18.6349 0 -M V30 56 H -0.0139 -2.2363 17.3723 0 -M V30 57 H -1.1225 -1.7455 13.0431 0 -M V30 58 H -1.0772 -3.9029 11.9020 0 -M V30 59 H 1.0820 -5.7081 15.0316 0 -M V30 60 H 1.0858 -3.5986 16.2391 0 -M V30 61 H 0.0026 0.0126 13.7460 0 -M V30 62 H 1.1195 3.5747 16.2634 0 -M V30 63 C -14.6172 4.7881 0.6066 0 -M V30 64 N -13.4123 4.8933 0.0000 0 -M V30 65 C -12.9018 3.7993 -0.5932 0 -M V30 66 C -13.5659 2.5874 -0.5996 0 -M V30 67 C -14.7939 2.4749 0.0171 0 -M V30 68 C -15.4939 1.1926 0.0090 0 -M V30 69 C -16.8711 1.1292 0.0077 0 -M V30 70 C -17.5565 -0.0840 -0.0004 0 -M V30 71 C -16.8578 -1.2740 -0.0075 0 -M V30 72 C -15.4780 -1.2425 -0.0064 0 -M V30 73 C -14.7497 -2.4936 -0.0146 0 -M V30 74 C -13.5220 -2.5919 -0.6235 0 -M V30 75 C -12.8806 -3.8096 -0.5967 0 -M V30 76 N -13.4123 -4.8933 -0.0000 0 -M V30 77 C -14.6118 -4.8155 0.6003 0 -M V30 78 C -15.2647 -3.6219 0.5866 0 -M V30 79 C -14.8141 -0.0144 0.0018 0 -M V30 80 C -15.3148 3.5984 0.6246 0 -M V30 81 H -14.9944 5.6977 1.0750 0 -M V30 82 H -11.9249 3.8319 -1.1009 0 -M V30 83 H -13.1630 1.6997 -1.0741 0 -M V30 84 H -17.4342 2.0590 0.0132 0 -M V30 85 H -18.6349 -0.1061 -0.0012 0 -M V30 86 H -17.3723 -2.2363 -0.0139 0 -M V30 87 H -13.0431 -1.7455 -1.1225 0 -M V30 88 H -11.9020 -3.9029 -1.0772 0 -M V30 89 H -15.0316 -5.7081 1.0820 0 -M V30 90 H -16.2391 -3.5986 1.0858 0 -M V30 91 H -13.7460 0.0126 0.0026 0 -M V30 92 H -16.2634 3.5747 1.1195 0 -M V30 93 C -0.6066 4.7881 -14.6172 0 -M V30 94 N -0.0000 4.8933 -13.4123 0 -M V30 95 C 0.5932 3.7993 -12.9018 0 -M V30 96 C 0.5996 2.5874 -13.5659 0 -M V30 97 C -0.0171 2.4749 -14.7939 0 -M V30 98 C -0.0090 1.1926 -15.4939 0 -M V30 99 C -0.0077 1.1292 -16.8711 0 -M V30 100 C 0.0004 -0.0840 -17.5565 0 -M V30 101 C 0.0075 -1.2740 -16.8578 0 -M V30 102 C 0.0064 -1.2425 -15.4780 0 -M V30 103 C 0.0146 -2.4936 -14.7497 0 -M V30 104 C 0.6235 -2.5919 -13.5220 0 -M V30 105 C 0.5967 -3.8096 -12.8806 0 -M V30 106 N -0.0000 -4.8933 -13.4123 0 -M V30 107 C -0.6003 -4.8155 -14.6118 0 -M V30 108 C -0.5866 -3.6219 -15.2647 0 -M V30 109 C -0.0018 -0.0144 -14.8141 0 -M V30 110 C -0.6246 3.5984 -15.3148 0 -M V30 111 H -1.0750 5.6977 -14.9944 0 -M V30 112 H 1.1009 3.8319 -11.9249 0 -M V30 113 H 1.0741 1.6997 -13.1630 0 -M V30 114 H -0.0132 2.0590 -17.4342 0 -M V30 115 H 0.0012 -0.1061 -18.6349 0 -M V30 116 H 0.0139 -2.2363 -17.3723 0 -M V30 117 H 1.1225 -1.7455 -13.0431 0 -M V30 118 H 1.0772 -3.9029 -11.9020 0 -M V30 119 H -1.0820 -5.7081 -15.0316 0 -M V30 120 H -1.0858 -3.5986 -16.2391 0 -M V30 121 H -0.0026 0.0126 -13.7460 0 -M V30 122 H -1.1195 3.5747 -16.2634 0 -M V30 END ATOM -M V30 BEGIN BOND -M V30 1 2 3 4 -M V30 2 1 4 5 -M V30 3 2 5 6 -M V30 4 1 6 7 -M V30 5 1 7 8 -M V30 6 2 8 9 -M V30 7 1 9 10 -M V30 8 2 10 11 -M V30 9 1 11 12 -M V30 10 1 12 13 -M V30 11 2 13 14 -M V30 12 1 14 15 -M V30 13 2 15 16 -M V30 14 1 16 17 -M V30 15 2 17 18 -M V30 16 2 12 19 -M V30 17 2 7 20 -M V30 18 1 20 3 -M V30 19 1 19 8 -M V30 20 1 18 13 -M V30 21 1 3 21 -M V30 22 1 5 22 -M V30 23 1 6 23 -M V30 24 1 9 24 -M V30 25 1 10 25 -M V30 26 1 11 26 -M V30 27 1 14 27 -M V30 28 1 15 28 -M V30 29 1 17 29 -M V30 30 1 18 30 -M V30 31 1 19 31 -M V30 32 1 20 32 -M V30 33 2 33 34 -M V30 34 1 34 35 -M V30 35 2 35 36 -M V30 36 1 36 37 -M V30 37 1 37 38 -M V30 38 2 38 39 -M V30 39 1 39 40 -M V30 40 2 40 41 -M V30 41 1 41 42 -M V30 42 1 42 43 -M V30 43 2 43 44 -M V30 44 1 44 45 -M V30 45 2 45 46 -M V30 46 1 46 47 -M V30 47 2 47 48 -M V30 48 2 42 49 -M V30 49 2 37 50 -M V30 50 1 50 33 -M V30 51 1 49 38 -M V30 52 1 48 43 -M V30 53 1 33 51 -M V30 54 1 35 52 -M V30 55 1 36 53 -M V30 56 1 39 54 -M V30 57 1 40 55 -M V30 58 1 41 56 -M V30 59 1 44 57 -M V30 60 1 45 58 -M V30 61 1 47 59 -M V30 62 1 48 60 -M V30 63 1 49 61 -M V30 64 1 50 62 -M V30 65 2 63 64 -M V30 66 1 64 65 -M V30 67 2 65 66 -M V30 68 1 66 67 -M V30 69 1 67 68 -M V30 70 2 68 69 -M V30 71 1 69 70 -M V30 72 2 70 71 -M V30 73 1 71 72 -M V30 74 1 72 73 -M V30 75 2 73 74 -M V30 76 1 74 75 -M V30 77 2 75 76 -M V30 78 1 76 77 -M V30 79 2 77 78 -M V30 80 2 72 79 -M V30 81 2 67 80 -M V30 82 1 80 63 -M V30 83 1 79 68 -M V30 84 1 78 73 -M V30 85 1 63 81 -M V30 86 1 65 82 -M V30 87 1 66 83 -M V30 88 1 69 84 -M V30 89 1 70 85 -M V30 90 1 71 86 -M V30 91 1 74 87 -M V30 92 1 75 88 -M V30 93 1 77 89 -M V30 94 1 78 90 -M V30 95 1 79 91 -M V30 96 1 80 92 -M V30 97 2 93 94 -M V30 98 1 94 95 -M V30 99 2 95 96 -M V30 100 1 96 97 -M V30 101 1 97 98 -M V30 102 2 98 99 -M V30 103 1 99 100 -M V30 104 2 100 101 -M V30 105 1 101 102 -M V30 106 1 102 103 -M V30 107 2 103 104 -M V30 108 1 104 105 -M V30 109 2 105 106 -M V30 110 1 106 107 -M V30 111 2 107 108 -M V30 112 2 102 109 -M V30 113 2 97 110 -M V30 114 1 110 93 -M V30 115 1 109 98 -M V30 116 1 108 103 -M V30 117 1 93 111 -M V30 118 1 95 112 -M V30 119 1 96 113 -M V30 120 1 99 114 -M V30 121 1 100 115 -M V30 122 1 101 116 -M V30 123 1 104 117 -M V30 124 1 105 118 -M V30 125 1 107 119 -M V30 126 1 108 120 -M V30 127 1 109 121 -M V30 128 1 110 122 -M V30 129 9 4 1 -M V30 130 9 34 1 -M V30 131 9 64 1 -M V30 132 9 94 1 -M V30 133 9 16 2 -M V30 134 9 46 2 -M V30 135 9 76 2 -M V30 136 9 106 2 -M V30 END BOND -M V30 END CTAB -M END - -$$$$ diff --git a/python/examples/data/stkbuilt.xyz b/python/examples/data/stkbuilt.xyz deleted file mode 100644 index a2b2b77c1..000000000 --- a/python/examples/data/stkbuilt.xyz +++ /dev/null @@ -1,460 +0,0 @@ -170 -e='4249.823439159263' rg='8.064591581900297' -C -2.539265 -1.258652 5.264906 -C -1.272508 -0.533842 5.264920 -C -1.240002 0.852666 5.264915 -C -0.071293 1.564287 5.264912 -C -0.057058 3.022874 5.264906 -C 1.096753 0.849687 5.264916 -C 1.135644 -0.543578 5.264921 -C 2.410952 -1.249066 5.264906 -C -0.068498 -1.196303 5.264924 -H -2.519966 -2.331290 5.264926 -H -2.198207 1.366919 5.264910 -H 0.872513 3.566283 5.264909 -H 2.049556 1.387347 5.264918 -H 3.308020 -0.669524 5.264853 -H -0.071162 -2.278757 5.264932 -C -5.374833 -3.133525 1.121164 -C -4.956375 -2.885377 -0.254822 -C -4.155871 -3.790945 -0.934967 -C -3.745013 -3.590602 -2.224674 -C -2.902893 -4.554773 -2.923880 -C -4.157591 -2.439833 -2.841515 -C -4.961997 -1.488539 -2.216480 -C -5.369299 -0.281907 -2.925189 -C -5.338850 -1.748602 -0.925606 -H -5.994137 -2.407300 1.611047 -H -3.858962 -4.686998 -0.395016 -H -2.589158 -4.380359 -3.939037 -H -3.847174 -2.248173 -3.872932 -H -5.034656 -0.150320 -3.930823 -H -5.963812 -1.028507 -0.413160 -C 5.152678 -2.933720 0.908531 -C 4.728546 -2.695399 -0.467455 -C 5.112538 -1.549357 -1.147601 -C 4.733608 -1.293716 -2.437308 -C 5.147544 -0.082333 -3.136513 -C 3.943302 -2.226402 -3.054149 -C 3.521660 -3.398686 -2.429114 -C 2.680337 -4.354736 -3.137823 -C 3.935307 -3.595019 -1.138239 -H 4.833401 -3.833165 1.398413 -H 5.740089 -0.844200 -0.607649 -H 4.839630 0.102163 -4.151671 -H 3.622111 -2.053404 -4.085566 -H 2.399058 -4.130720 -4.143457 -H 3.624168 -4.496299 -0.625794 -C 0.277117 5.888956 0.743356 -C 0.282791 5.402487 -0.632630 -C -0.901706 5.162014 -1.312775 -C -0.933633 4.706030 -2.602482 -C -2.189689 4.458817 -3.301688 -C 0.269251 4.487948 -3.219323 -C 1.495299 4.708937 -2.594288 -C 2.743924 4.458354 -3.302997 -C 1.458505 5.165332 -1.303414 -H 1.215698 6.062177 1.233239 -H -1.826165 5.352910 -0.772824 -H -2.195510 4.099908 -4.316845 -H 0.280025 4.123289 -4.250740 -H 2.690560 4.102752 -4.308631 -H 2.394605 5.346518 -0.790968 -N -3.999495 -2.425341 5.223593 -C -5.415765 -2.815495 5.161259 -C -5.787157 -3.278124 6.552266 -C -7.061933 -4.059514 6.594534 -C -7.708727 -3.930169 5.211283 -C -6.793416 -4.717415 4.277598 -C -5.525603 -3.894586 4.133801 -N -5.475186 -3.277332 2.813798 -H -5.963621 -1.884023 4.874471 -H -4.966460 -3.945073 6.894586 -H -5.910867 -2.390962 7.199190 -H -6.865001 -5.155732 6.716028 -H -7.733194 -3.736703 7.395857 -H -8.705703 -4.380945 5.297076 -H -7.773831 -2.874231 4.926368 -H -6.484394 -5.662451 4.798149 -H -7.265322 -4.964195 3.328501 -H -4.607170 -4.542551 4.189235 -N 3.699332 -2.369059 5.240841 -C 4.745624 -3.400235 5.178578 -C 5.332126 -3.490167 6.569543 -C 6.646414 -4.203097 6.611804 -C 6.857832 -4.828082 5.228637 -C 7.081541 -3.641871 4.294733 -C 5.734844 -2.955714 4.150951 -N 5.175024 -3.221050 2.831046 -H 4.213101 -4.340620 4.891996 -H 5.499122 -2.445846 6.911674 -H 4.625886 -4.040968 7.216627 -H 7.497117 -3.484190 6.733098 -H 6.702760 -4.945684 7.413245 -H 7.746884 -5.465846 5.314450 -H 5.976045 -5.412718 4.943903 -H 7.745305 -2.901466 4.815099 -H 7.531198 -3.927199 3.345640 -H 5.836485 -1.836309 4.206190 -N -0.231290 4.731746 4.640969 -C 0.139258 6.153268 4.578579 -C -0.075362 6.706265 5.969619 -C -0.114349 8.200956 6.011893 -C 0.320960 8.696330 4.628576 -C -0.818699 8.297516 3.695064 -C -0.740362 6.788126 3.551255 -N -0.231290 6.435728 2.231175 -H 1.219823 6.161757 4.291626 -H -1.063334 6.329207 6.312089 -H 0.754824 6.369640 6.616416 -H -1.162067 8.578743 6.133547 -H 0.501057 8.620747 6.813122 -H 0.429312 9.785101 4.714351 -H 1.267836 8.224538 4.343516 -H -1.791511 8.502623 4.215764 -H -0.796493 8.829584 2.745964 -H -1.760826 6.316943 3.606845 -N -1.521851 -5.378862 -3.455668 -C -0.650193 -6.082881 -4.407769 -C -1.466699 -7.231016 -4.957277 -C -0.638255 -8.269686 -5.644484 -C 0.777222 -7.696466 -5.772138 -C 1.309176 -7.648984 -4.342422 -C 0.555149 -6.529935 -3.646543 -N 1.429533 -5.378862 -3.455668 -H -0.410995 -5.329142 -5.198147 -H -1.964019 -7.711781 -4.087171 -H -2.189157 -6.831951 -5.691902 -H -0.519470 -9.184004 -5.007971 -H -1.050090 -8.571625 -6.612030 -H 1.335789 -8.399982 -6.402685 -H 0.737584 -6.700729 -6.227505 -H 1.002445 -8.593010 -3.818692 -H 2.391303 -7.543481 -4.294970 -H 0.237722 -6.831527 -2.609850 -N -5.245782 1.408822 -3.680600 -C -5.790215 2.729654 -4.028337 -C -6.977649 2.472400 -4.928713 -C -7.423593 3.686470 -5.680096 -C -6.655211 4.877297 -5.097023 -C -5.207724 4.655838 -5.527204 -C -4.694363 3.488773 -4.702888 -N -3.770090 3.964795 -3.680600 -H -6.099376 3.184350 -3.054835 -H -6.653889 1.711221 -5.671231 -H -7.824138 2.126897 -4.308263 -H -7.107322 3.641032 -6.753941 -H -8.506709 3.836261 -5.643458 -H -7.093386 5.775255 -5.551109 -H -6.760516 4.892324 -4.006561 -H -5.204884 4.300015 -6.591602 -H -4.597546 5.553084 -5.443457 -H -4.093032 2.775062 -5.331751 -N 5.719316 1.464169 -4.042220 -C 5.893186 2.571056 -4.994321 -C 7.295753 2.438009 -5.543830 -C 7.781046 3.674797 -6.231037 -C 6.576884 4.614027 -6.358691 -C 6.269787 5.050972 -4.928975 -C 5.677675 3.838440 -4.233095 -N 4.243624 4.020142 -4.042220 -H 5.120830 2.401338 -5.784699 -H 7.960768 2.247699 -4.673723 -H 7.311382 1.612809 -6.278455 -H 8.513476 4.234827 -5.594524 -H 8.248450 3.469107 -7.198582 -H 6.906863 5.449517 -6.989237 -H 5.734370 4.081830 -6.814057 -H 7.240702 5.257347 -4.405244 -H 5.637355 5.935369 -4.881523 -H 6.097575 3.714337 -3.196402 -Br 1.187001 0.000000 0.000000 -Br -1.187001 0.000000 0.000000 -80 -e='69001.98212643963' rg='7.271655994630595' -C -1.213436 -0.700577 7.692133 -C 0.002427 0.019462 8.153242 -C 1.228923 -0.712778 7.692133 -C -0.015487 1.413355 7.692133 -H -1.410645 -0.866019 6.646722 -H 0.022807 0.032828 9.263985 -H 1.377876 -0.850759 6.615830 -H 0.769601 2.127094 7.909346 -C -6.685079 -3.859632 -1.243023 -C -6.645858 -3.855049 -2.728904 -C -6.692123 -2.441402 -3.231449 -C -5.464600 -4.577285 -3.217661 -H -5.927022 -3.370385 -0.655542 -H -7.545059 -4.375802 -3.122092 -H -5.892988 -1.756043 -2.929257 -H -5.229876 -4.702235 -4.267547 -C 6.685079 -3.859632 -1.243023 -C 6.661499 -3.827957 -2.728904 -C 5.460378 -4.574847 -3.231449 -C 6.696345 -2.443840 -3.217661 -H 5.882350 -3.447759 -0.655542 -H 7.562085 -4.346311 -3.122092 -H 4.467272 -4.225456 -2.929257 -H 6.687193 -2.178088 -4.267547 -C -0.000000 7.719264 -1.243023 -C -0.015641 7.683006 -2.728904 -C 1.231745 7.016250 -3.231449 -C -1.231745 7.021124 -3.217661 -H 0.044672 6.818144 -0.655542 -H -0.017027 8.722114 -3.122092 -H 1.425717 5.981499 -2.929257 -H -1.457317 6.880323 -4.267547 -N -3.217755 -1.857772 4.419093 -C -4.605053 -2.231333 4.442108 -C -4.928956 -3.207931 3.315232 -N -4.680760 -2.702438 2.030017 -H -5.247674 -1.330030 4.365139 -H -4.778399 -2.783091 5.391129 -H -4.238774 -4.083144 3.488397 -H -5.970227 -3.551659 3.421200 -N 3.225498 -1.863872 4.419093 -C 4.242450 -2.878739 4.442054 -C 5.250286 -2.671014 3.315278 -N 4.688503 -2.708538 2.030017 -H 3.783008 -3.885812 4.364924 -H 4.806916 -2.753218 5.391132 -H 5.663352 -1.635799 3.488604 -H 6.068440 -3.401099 3.421213 -N -0.007744 3.721644 4.419093 -C 0.360803 5.110277 4.442403 -C -0.322972 5.878312 3.314981 -N -0.007744 5.410976 2.030017 -H 1.462605 5.217398 4.366316 -H -0.031601 5.535835 5.391111 -H -1.425976 5.716955 3.487264 -H -0.101313 6.952194 3.421126 -N -1.465116 -4.576066 -3.224555 -C -0.682420 -5.300270 -4.187669 -C 0.681541 -5.675456 -3.615523 -N 1.460894 -4.576066 -3.224555 -H -0.558448 -4.699922 -5.112572 -H -1.211341 -6.257805 -4.383879 -H 0.447714 -6.285689 -2.696134 -H 1.214880 -6.313621 -4.337962 -N -4.693436 1.022862 -3.224555 -C -5.298547 2.276001 -3.582542 -C -4.259262 3.250937 -4.128338 -N -3.230432 3.556860 -3.224555 -H -5.815956 2.717878 -2.706034 -H -6.001998 2.071394 -4.418257 -H -3.804158 2.718182 -5.012300 -H -4.767701 4.160331 -4.486267 -N 4.695547 1.019206 -3.224555 -C 4.931379 2.059142 -4.187669 -C 4.574318 3.427960 -3.615523 -N 3.232542 3.553204 -3.224555 -H 4.349476 1.866331 -5.112572 -H 6.025088 2.079850 -4.383879 -H 5.219710 3.530576 -2.696134 -H 4.860316 4.208927 -4.337962 -80 -e='3541.3491046932395' rg='5.472767402726612' -C -1.255585 -0.422519 4.077182 -C -0.039723 0.297521 4.538291 -C 1.186773 -0.434719 4.077182 -C -0.057637 1.691414 4.077182 -H -1.452795 -0.587960 3.031771 -H -0.019343 0.310887 5.649034 -H 1.335727 -0.572700 3.000879 -H 0.727451 2.405153 4.294395 -C -3.749829 -1.780548 0.183890 -C -3.710608 -1.775965 -1.301990 -C -3.756873 -0.362318 -1.804536 -C -2.529350 -2.498201 -1.790748 -H -2.991772 -1.291301 0.771371 -H -4.609809 -2.296718 -1.695179 -H -2.957739 0.323041 -1.502343 -H -2.294626 -2.623151 -2.840634 -C 3.623250 -2.036431 -0.262952 -C 3.599671 -2.004756 -1.748833 -C 2.398549 -2.751646 -2.251378 -C 3.634516 -0.620638 -2.237590 -H 2.820522 -1.624557 0.324529 -H 4.500257 -2.523110 -2.142021 -H 1.405443 -2.402255 -1.949186 -H 3.625364 -0.354887 -3.287476 -C -0.165382 5.015399 -0.129381 -C -0.181023 4.979141 -1.615261 -C 1.066363 4.312384 -2.117807 -C -1.397127 4.317259 -2.104019 -H -0.120710 4.114278 0.458100 -H -0.182408 6.018248 -2.008450 -H 1.260335 3.277633 -1.815614 -H -1.622699 4.176457 -3.153905 -N -2.486978 -1.428420 4.102662 -C -3.874276 -1.801981 4.125677 -C -4.198179 -2.778579 2.998801 -N -3.949983 -2.273086 1.713586 -H -4.516897 -0.900678 4.048708 -H -4.047622 -2.353739 5.074698 -H -3.507997 -3.653792 3.171966 -H -5.239450 -3.122307 3.104769 -N 2.491408 -1.460608 3.681493 -C 3.508360 -2.475475 3.704454 -C 4.516195 -2.267750 2.577678 -N 3.954413 -2.305274 1.292416 -H 3.048917 -3.482548 3.627324 -H 4.072826 -2.349954 4.653532 -H 4.929261 -1.232535 2.751003 -H 5.334349 -2.997834 2.683613 -N -0.043150 3.558952 3.906022 -C 0.325396 4.947586 3.929332 -C -0.358378 5.715620 2.801910 -N -0.043150 5.248285 1.516945 -H 1.427199 5.054707 3.853244 -H -0.067007 5.373144 4.878040 -H -1.461383 5.554264 2.974192 -H -0.136720 6.789502 2.908055 -N -1.594724 -3.795798 -2.658274 -C -0.812029 -4.520003 -3.621388 -C 0.551933 -4.895188 -3.049242 -N 1.331285 -3.795798 -2.658274 -H -0.688057 -3.919654 -4.546291 -H -1.340950 -5.477537 -3.817598 -H 0.318105 -5.505422 -2.129853 -H 1.085271 -5.533353 -3.771680 -N -4.012942 0.808983 -2.769006 -C -4.618052 2.062123 -3.126994 -C -3.578767 3.037058 -3.672789 -N -2.549937 3.342982 -2.769006 -H -5.135461 2.503999 -2.250486 -H -5.321503 1.857515 -3.962709 -H -3.123663 2.504303 -4.556751 -H -4.087207 3.946453 -4.030719 -N 3.899485 1.167738 -2.733970 -C 4.135317 2.207675 -3.697084 -C 3.778256 3.576493 -3.124938 -N 2.436481 3.701737 -2.733970 -H 3.553414 2.014863 -4.621987 -H 5.229026 2.228383 -3.893294 -H 4.423648 3.679109 -2.205550 -H 4.064254 4.357460 -3.847377 -122 -e='361.28646712346455' rg='15.220721731729968' -Pd 0.000000 6.706139 0.000000 -Pd 0.000000 -6.706139 0.000000 -C 14.617151 4.788114 -0.606619 -N 13.412279 4.893306 -0.000000 -C 12.901820 3.799282 0.593223 -C 13.565877 2.587447 0.599618 -C 14.793916 2.474878 -0.017105 -C 15.493884 1.192641 -0.008968 -C 16.871077 1.129187 -0.007671 -C 17.556534 -0.083989 0.000424 -C 16.857801 -1.274026 0.007511 -C 15.478020 -1.242464 0.006411 -C 14.749705 -2.493615 0.014614 -C 13.522003 -2.591883 0.623452 -C 12.880642 -3.809551 0.596673 -N 13.412279 -4.893306 0.000000 -C 14.611776 -4.815506 -0.600290 -C 15.264750 -3.621907 -0.586634 -C 14.814107 -0.014410 -0.001813 -C 15.314784 3.598395 -0.624584 -H 14.994387 5.697699 -1.075037 -H 11.924946 3.831871 1.100866 -H 13.163007 1.699657 1.074149 -H 17.434224 2.059040 -0.013178 -H 18.634873 -0.106053 0.001236 -H 17.372346 -2.236272 0.013913 -H 13.043071 -1.745509 1.122496 -H 11.901981 -3.902911 1.077175 -H 15.031603 -5.708122 -1.081966 -H 16.239128 -3.598600 -1.085790 -H 13.746032 0.012568 -0.002636 -H 16.263366 3.574652 -1.119470 -C 0.606619 4.788114 14.617151 -N 0.000000 4.893306 13.412279 -C -0.593223 3.799282 12.901820 -C -0.599618 2.587447 13.565877 -C 0.017105 2.474878 14.793916 -C 0.008968 1.192641 15.493884 -C 0.007671 1.129187 16.871077 -C -0.000424 -0.083989 17.556534 -C -0.007511 -1.274026 16.857801 -C -0.006411 -1.242464 15.478020 -C -0.014614 -2.493615 14.749705 -C -0.623452 -2.591883 13.522003 -C -0.596673 -3.809551 12.880642 -N 0.000000 -4.893306 13.412279 -C 0.600290 -4.815506 14.611776 -C 0.586634 -3.621907 15.264750 -C 0.001813 -0.014410 14.814107 -C 0.624584 3.598395 15.314784 -H 1.075037 5.697699 14.994387 -H -1.100866 3.831871 11.924946 -H -1.074149 1.699657 13.163007 -H 0.013178 2.059040 17.434224 -H -0.001236 -0.106053 18.634873 -H -0.013913 -2.236272 17.372346 -H -1.122496 -1.745509 13.043071 -H -1.077175 -3.902911 11.901981 -H 1.081966 -5.708122 15.031603 -H 1.085790 -3.598600 16.239128 -H 0.002636 0.012568 13.746032 -H 1.119470 3.574652 16.263366 -C -14.617151 4.788114 0.606619 -N -13.412279 4.893306 0.000000 -C -12.901820 3.799282 -0.593223 -C -13.565877 2.587447 -0.599618 -C -14.793916 2.474878 0.017105 -C -15.493884 1.192641 0.008968 -C -16.871077 1.129187 0.007671 -C -17.556534 -0.083989 -0.000424 -C -16.857801 -1.274026 -0.007511 -C -15.478020 -1.242464 -0.006411 -C -14.749705 -2.493615 -0.014614 -C -13.522003 -2.591883 -0.623452 -C -12.880642 -3.809551 -0.596673 -N -13.412279 -4.893306 -0.000000 -C -14.611776 -4.815506 0.600290 -C -15.264750 -3.621907 0.586634 -C -14.814107 -0.014410 0.001813 -C -15.314784 3.598395 0.624584 -H -14.994387 5.697699 1.075037 -H -11.924946 3.831871 -1.100866 -H -13.163007 1.699657 -1.074149 -H -17.434224 2.059040 0.013178 -H -18.634873 -0.106053 -0.001236 -H -17.372346 -2.236272 -0.013913 -H -13.043071 -1.745509 -1.122496 -H -11.901981 -3.902911 -1.077175 -H -15.031603 -5.708122 1.081966 -H -16.239128 -3.598600 1.085790 -H -13.746032 0.012568 0.002636 -H -16.263366 3.574652 1.119470 -C -0.606619 4.788114 -14.617151 -N -0.000000 4.893306 -13.412279 -C 0.593223 3.799282 -12.901820 -C 0.599618 2.587447 -13.565877 -C -0.017105 2.474878 -14.793916 -C -0.008968 1.192641 -15.493884 -C -0.007671 1.129187 -16.871077 -C 0.000424 -0.083989 -17.556534 -C 0.007511 -1.274026 -16.857801 -C 0.006411 -1.242464 -15.478020 -C 0.014614 -2.493615 -14.749705 -C 0.623452 -2.591883 -13.522003 -C 0.596673 -3.809551 -12.880642 -N -0.000000 -4.893306 -13.412279 -C -0.600290 -4.815506 -14.611776 -C -0.586634 -3.621907 -15.264750 -C -0.001813 -0.014410 -14.814107 -C -0.624584 3.598395 -15.314784 -H -1.075037 5.697699 -14.994387 -H 1.100866 3.831871 -11.924946 -H 1.074149 1.699657 -13.163007 -H -0.013178 2.059040 -17.434224 -H 0.001236 -0.106053 -18.634873 -H 0.013913 -2.236272 -17.372346 -H 1.122496 -1.745509 -13.043071 -H 1.077175 -3.902911 -11.901981 -H -1.081966 -5.708122 -15.031603 -H -1.085790 -3.598600 -16.239128 -H -0.002636 0.012568 -13.746032 -H -1.119470 3.574652 -16.263366 diff --git a/python/examples/data/unoptcage.mol b/python/examples/data/unoptcage.mol deleted file mode 100644 index d61446e47..000000000 --- a/python/examples/data/unoptcage.mol +++ /dev/null @@ -1,176 +0,0 @@ - - RDKit 3D - - 0 0 0 0 0 0 0 0 0 0999 V3000 -M V30 BEGIN CTAB -M V30 COUNTS 80 82 0 0 0 -M V30 BEGIN ATOM -M V30 1 C -1.2134 -0.7006 7.6921 0 -M V30 2 C 0.0024 0.0195 8.1532 0 -M V30 3 C 1.2289 -0.7128 7.6921 0 -M V30 4 C -0.0155 1.4134 7.6921 0 -M V30 5 H -1.4106 -0.8660 6.6467 0 -M V30 6 H 0.0228 0.0328 9.2640 0 -M V30 7 H 1.3779 -0.8508 6.6158 0 -M V30 8 H 0.7696 2.1271 7.9093 0 -M V30 9 C -6.6851 -3.8596 -1.2430 0 -M V30 10 C -6.6459 -3.8550 -2.7289 0 -M V30 11 C -6.6921 -2.4414 -3.2314 0 -M V30 12 C -5.4646 -4.5773 -3.2177 0 -M V30 13 H -5.9270 -3.3704 -0.6555 0 -M V30 14 H -7.5451 -4.3758 -3.1221 0 -M V30 15 H -5.8930 -1.7560 -2.9293 0 -M V30 16 H -5.2299 -4.7022 -4.2675 0 -M V30 17 C 6.6851 -3.8596 -1.2430 0 -M V30 18 C 6.6615 -3.8280 -2.7289 0 -M V30 19 C 5.4604 -4.5748 -3.2314 0 -M V30 20 C 6.6963 -2.4438 -3.2177 0 -M V30 21 H 5.8824 -3.4478 -0.6555 0 -M V30 22 H 7.5621 -4.3463 -3.1221 0 -M V30 23 H 4.4673 -4.2255 -2.9293 0 -M V30 24 H 6.6872 -2.1781 -4.2675 0 -M V30 25 C -0.0000 7.7193 -1.2430 0 -M V30 26 C -0.0156 7.6830 -2.7289 0 -M V30 27 C 1.2317 7.0162 -3.2314 0 -M V30 28 C -1.2317 7.0211 -3.2177 0 -M V30 29 H 0.0447 6.8181 -0.6555 0 -M V30 30 H -0.0170 8.7221 -3.1221 0 -M V30 31 H 1.4257 5.9815 -2.9293 0 -M V30 32 H -1.4573 6.8803 -4.2675 0 -M V30 33 N -3.2178 -1.8578 4.4191 0 -M V30 34 C -4.6051 -2.2313 4.4421 0 -M V30 35 C -4.9290 -3.2079 3.3152 0 -M V30 36 N -4.6808 -2.7024 2.0300 0 -M V30 37 H -5.2477 -1.3300 4.3651 0 -M V30 38 H -4.7784 -2.7831 5.3911 0 -M V30 39 H -4.2388 -4.0831 3.4884 0 -M V30 40 H -5.9702 -3.5517 3.4212 0 -M V30 41 N 3.2255 -1.8639 4.4191 0 -M V30 42 C 4.2425 -2.8787 4.4421 0 -M V30 43 C 5.2503 -2.6710 3.3153 0 -M V30 44 N 4.6885 -2.7085 2.0300 0 -M V30 45 H 3.7830 -3.8858 4.3649 0 -M V30 46 H 4.8069 -2.7532 5.3911 0 -M V30 47 H 5.6634 -1.6358 3.4886 0 -M V30 48 H 6.0684 -3.4011 3.4212 0 -M V30 49 N -0.0077 3.7216 4.4191 0 -M V30 50 C 0.3608 5.1103 4.4424 0 -M V30 51 C -0.3230 5.8783 3.3150 0 -M V30 52 N -0.0077 5.4110 2.0300 0 -M V30 53 H 1.4626 5.2174 4.3663 0 -M V30 54 H -0.0316 5.5358 5.3911 0 -M V30 55 H -1.4260 5.7170 3.4873 0 -M V30 56 H -0.1013 6.9522 3.4211 0 -M V30 57 N -1.4651 -4.5761 -3.2246 0 -M V30 58 C -0.6824 -5.3003 -4.1877 0 -M V30 59 C 0.6815 -5.6755 -3.6155 0 -M V30 60 N 1.4609 -4.5761 -3.2246 0 -M V30 61 H -0.5584 -4.6999 -5.1126 0 -M V30 62 H -1.2113 -6.2578 -4.3839 0 -M V30 63 H 0.4477 -6.2857 -2.6961 0 -M V30 64 H 1.2149 -6.3136 -4.3380 0 -M V30 65 N -4.6934 1.0229 -3.2246 0 -M V30 66 C -5.2985 2.2760 -3.5825 0 -M V30 67 C -4.2593 3.2509 -4.1283 0 -M V30 68 N -3.2304 3.5569 -3.2246 0 -M V30 69 H -5.8160 2.7179 -2.7060 0 -M V30 70 H -6.0020 2.0714 -4.4183 0 -M V30 71 H -3.8042 2.7182 -5.0123 0 -M V30 72 H -4.7677 4.1603 -4.4863 0 -M V30 73 N 4.6955 1.0192 -3.2246 0 -M V30 74 C 4.9314 2.0591 -4.1877 0 -M V30 75 C 4.5743 3.4280 -3.6155 0 -M V30 76 N 3.2325 3.5532 -3.2246 0 -M V30 77 H 4.3495 1.8663 -5.1126 0 -M V30 78 H 6.0251 2.0799 -4.3839 0 -M V30 79 H 5.2197 3.5306 -2.6961 0 -M V30 80 H 4.8603 4.2089 -4.3380 0 -M V30 END ATOM -M V30 BEGIN BOND -M V30 1 1 1 2 -M V30 2 1 2 3 -M V30 3 1 2 4 -M V30 4 1 1 5 -M V30 5 1 2 6 -M V30 6 1 3 7 -M V30 7 1 4 8 -M V30 8 1 9 10 -M V30 9 1 10 11 -M V30 10 1 10 12 -M V30 11 1 9 13 -M V30 12 1 10 14 -M V30 13 1 11 15 -M V30 14 1 12 16 -M V30 15 1 17 18 -M V30 16 1 18 19 -M V30 17 1 18 20 -M V30 18 1 17 21 -M V30 19 1 18 22 -M V30 20 1 19 23 -M V30 21 1 20 24 -M V30 22 1 25 26 -M V30 23 1 26 27 -M V30 24 1 26 28 -M V30 25 1 25 29 -M V30 26 1 26 30 -M V30 27 1 27 31 -M V30 28 1 28 32 -M V30 29 1 33 34 -M V30 30 1 34 35 -M V30 31 1 35 36 -M V30 32 1 34 37 -M V30 33 1 34 38 -M V30 34 1 35 39 -M V30 35 1 35 40 -M V30 36 1 41 42 -M V30 37 1 42 43 -M V30 38 1 43 44 -M V30 39 1 42 45 -M V30 40 1 42 46 -M V30 41 1 43 47 -M V30 42 1 43 48 -M V30 43 1 49 50 -M V30 44 1 50 51 -M V30 45 1 51 52 -M V30 46 1 50 53 -M V30 47 1 50 54 -M V30 48 1 51 55 -M V30 49 1 51 56 -M V30 50 1 57 58 -M V30 51 1 58 59 -M V30 52 1 59 60 -M V30 53 1 58 61 -M V30 54 1 58 62 -M V30 55 1 59 63 -M V30 56 1 59 64 -M V30 57 1 65 66 -M V30 58 1 66 67 -M V30 59 1 67 68 -M V30 60 1 66 69 -M V30 61 1 66 70 -M V30 62 1 67 71 -M V30 63 1 67 72 -M V30 64 1 73 74 -M V30 65 1 74 75 -M V30 66 1 75 76 -M V30 67 1 74 77 -M V30 68 1 74 78 -M V30 69 1 75 79 -M V30 70 1 75 80 -M V30 71 2 1 33 -M V30 72 2 9 36 -M V30 73 2 3 41 -M V30 74 2 17 44 -M V30 75 2 4 49 -M V30 76 2 25 52 -M V30 77 2 12 57 -M V30 78 2 19 60 -M V30 79 2 11 65 -M V30 80 2 28 68 -M V30 81 2 20 73 -M V30 82 2 27 76 -M V30 END BOND -M V30 END CTAB -M END - -$$$$ From b0bb1e62c73dc3568ac33fc5404832d743fecb8f Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Tue, 24 Sep 2024 17:26:49 +0200 Subject: [PATCH 08/35] Update tests. --- python/tests/create_input.py | 605 +++++++++++++++++---------------- python/tests/stk_structures.py | 143 ++++++++ python/tests/write_input.py | 47 +-- 3 files changed, 488 insertions(+), 307 deletions(-) create mode 100644 python/tests/stk_structures.py diff --git a/python/tests/create_input.py b/python/tests/create_input.py index 7a16586ae..81b3409c6 100644 --- a/python/tests/create_input.py +++ b/python/tests/create_input.py @@ -2,323 +2,354 @@ import ase import numpy as np +import stk from chemiscope import all_atomic_environments, create_input +# These should be the same molecule! TEST_FRAMES = [ase.Atoms("CO2")] +TEST_FRAMES_STK = [stk.BuildingBlock("O=C=O")] class TestCreateInputMeta(unittest.TestCase): def test_meta(self): - meta = {} - data = create_input(frames=TEST_FRAMES, meta=meta) - self.assertEqual(data["meta"]["name"], "") - self.assertEqual(len(data["meta"].keys()), 1) - - meta = {"name": ""} - data = create_input(frames=TEST_FRAMES, meta=meta) - self.assertEqual(data["meta"]["name"], "") - self.assertEqual(len(data["meta"].keys()), 1) - - meta = {"name": "foo"} - data = create_input(frames=TEST_FRAMES, meta=meta) - self.assertEqual(data["meta"]["name"], "foo") - self.assertEqual(len(data["meta"].keys()), 1) - - meta = {"name": "foo", "description": "bar"} - data = create_input(frames=TEST_FRAMES, meta=meta) - self.assertEqual(data["meta"]["name"], "foo") - self.assertEqual(data["meta"]["description"], "bar") - self.assertEqual(len(data["meta"].keys()), 2) - - meta = {"name": "foo", "references": ["bar"]} - data = create_input(frames=TEST_FRAMES, meta=meta) - self.assertEqual(data["meta"]["name"], "foo") - self.assertEqual(len(data["meta"]["references"]), 1) - self.assertEqual(data["meta"]["references"][0], "bar") - self.assertEqual(len(data["meta"].keys()), 2) - - meta = {"name": "foo", "authors": ["bar"]} - data = create_input(frames=TEST_FRAMES, meta=meta) - self.assertEqual(data["meta"]["name"], "foo") - self.assertEqual(len(data["meta"]["authors"]), 1) - self.assertEqual(data["meta"]["authors"][0], "bar") - self.assertEqual(len(data["meta"].keys()), 2) + for TF in (TEST_FRAMES, TEST_FRAMES_STK): + meta = {} + data = create_input(frames=TF, meta=meta) + self.assertEqual(data["meta"]["name"], "") + self.assertEqual(len(data["meta"].keys()), 1) + + meta = {"name": ""} + data = create_input(frames=TF, meta=meta) + self.assertEqual(data["meta"]["name"], "") + self.assertEqual(len(data["meta"].keys()), 1) + + meta = {"name": "foo"} + data = create_input(frames=TF, meta=meta) + self.assertEqual(data["meta"]["name"], "foo") + self.assertEqual(len(data["meta"].keys()), 1) + + meta = {"name": "foo", "description": "bar"} + data = create_input(frames=TF, meta=meta) + self.assertEqual(data["meta"]["name"], "foo") + self.assertEqual(data["meta"]["description"], "bar") + self.assertEqual(len(data["meta"].keys()), 2) + + meta = {"name": "foo", "references": ["bar"]} + data = create_input(frames=TF, meta=meta) + self.assertEqual(data["meta"]["name"], "foo") + self.assertEqual(len(data["meta"]["references"]), 1) + self.assertEqual(data["meta"]["references"][0], "bar") + self.assertEqual(len(data["meta"].keys()), 2) + + meta = {"name": "foo", "authors": ["bar"]} + data = create_input(frames=TF, meta=meta) + self.assertEqual(data["meta"]["name"], "foo") + self.assertEqual(len(data["meta"]["authors"]), 1) + self.assertEqual(data["meta"]["authors"][0], "bar") + self.assertEqual(len(data["meta"].keys()), 2) def test_meta_unknown_keys_warning(self): - meta = {"name": "foo", "what_is_this": "I don't know"} - with self.assertWarns(UserWarning) as cm: - data = create_input(frames=TEST_FRAMES, meta=meta) + for TF in (TEST_FRAMES, TEST_FRAMES_STK): + meta = {"name": "foo", "what_is_this": "I don't know"} + with self.assertWarns(UserWarning) as cm: + data = create_input(frames=TF, meta=meta) - self.assertEqual(data["meta"]["name"], "foo") - self.assertEqual(len(data["meta"].keys()), 1) + self.assertEqual(data["meta"]["name"], "foo") + self.assertEqual(len(data["meta"].keys()), 1) - self.assertEqual(str(cm.warning), "ignoring unexpected metadata: what_is_this") + self.assertEqual( + str(cm.warning), "ignoring unexpected metadata: what_is_this" + ) def test_meta_conversions(self): - meta = {"name": 33} - data = create_input(frames=TEST_FRAMES, meta=meta) - self.assertEqual(data["meta"]["name"], "33") - self.assertEqual(len(data["meta"].keys()), 1) - - meta = {"name": ["foo", "bar"], "description": False} - data = create_input(frames=TEST_FRAMES, meta=meta) - self.assertEqual(data["meta"]["name"], "['foo', 'bar']") - self.assertEqual(data["meta"]["description"], "False") - self.assertEqual(len(data["meta"].keys()), 2) - - meta = {"name": "foo", "references": (3, False)} - data = create_input(frames=TEST_FRAMES, meta=meta) - self.assertEqual(data["meta"]["name"], "foo") - self.assertEqual(len(data["meta"]["references"]), 2) - self.assertEqual(data["meta"]["references"][0], "3") - self.assertEqual(data["meta"]["references"][1], "False") - self.assertEqual(len(data["meta"].keys()), 2) - - meta = {"name": "foo", "authors": (3, False)} - data = create_input(frames=TEST_FRAMES, meta=meta) - self.assertEqual(data["meta"]["name"], "foo") - self.assertEqual(len(data["meta"]["authors"]), 2) - self.assertEqual(data["meta"]["authors"][0], "3") - self.assertEqual(data["meta"]["authors"][1], "False") - self.assertEqual(len(data["meta"].keys()), 2) + for TF in (TEST_FRAMES, TEST_FRAMES_STK): + meta = {"name": 33} + data = create_input(frames=TF, meta=meta) + self.assertEqual(data["meta"]["name"], "33") + self.assertEqual(len(data["meta"].keys()), 1) + + meta = {"name": ["foo", "bar"], "description": False} + data = create_input(frames=TF, meta=meta) + self.assertEqual(data["meta"]["name"], "['foo', 'bar']") + self.assertEqual(data["meta"]["description"], "False") + self.assertEqual(len(data["meta"].keys()), 2) + + meta = {"name": "foo", "references": (3, False)} + data = create_input(frames=TF, meta=meta) + self.assertEqual(data["meta"]["name"], "foo") + self.assertEqual(len(data["meta"]["references"]), 2) + self.assertEqual(data["meta"]["references"][0], "3") + self.assertEqual(data["meta"]["references"][1], "False") + self.assertEqual(len(data["meta"].keys()), 2) + + meta = {"name": "foo", "authors": (3, False)} + data = create_input(frames=TF, meta=meta) + self.assertEqual(data["meta"]["name"], "foo") + self.assertEqual(len(data["meta"]["authors"]), 2) + self.assertEqual(data["meta"]["authors"][0], "3") + self.assertEqual(data["meta"]["authors"][1], "False") + self.assertEqual(len(data["meta"].keys()), 2) class TestCreateInputProperties(unittest.TestCase): def test_properties(self): - # values are numbers - properties = {"name": {"target": "atom", "values": [2, 3, 4]}} - data = create_input(frames=TEST_FRAMES, properties=properties) - self.assertEqual(data["properties"]["name"]["target"], "atom") - self.assertEqual(data["properties"]["name"]["values"], [2, 3, 4]) - self.assertEqual(len(data["properties"]["name"].keys()), 2) - - # values are strings - properties = {"name": {"target": "atom", "values": ["2", "3", "4"]}} - data = create_input(frames=TEST_FRAMES, properties=properties) - self.assertEqual(data["properties"]["name"]["target"], "atom") - self.assertEqual(data["properties"]["name"]["values"], ["2", "3", "4"]) - self.assertEqual(len(data["properties"]["name"].keys()), 2) - - properties = { - "name": { - "target": "atom", - "values": [2, 3, 4], - "description": "foo", - }, - } - data = create_input(frames=TEST_FRAMES, properties=properties) - self.assertEqual(data["properties"]["name"]["target"], "atom") - self.assertEqual(data["properties"]["name"]["description"], "foo") - self.assertEqual(data["properties"]["name"]["values"], [2, 3, 4]) - self.assertEqual(len(data["properties"]["name"].keys()), 3) - - properties = { - "name": { - "target": "atom", - "values": [2, 3, 4], - "units": "foo", - }, - } - data = create_input(frames=TEST_FRAMES, properties=properties) - self.assertEqual(data["properties"]["name"]["target"], "atom") - self.assertEqual(data["properties"]["name"]["units"], "foo") - self.assertEqual(data["properties"]["name"]["values"], [2, 3, 4]) - self.assertEqual(len(data["properties"]["name"].keys()), 3) + for TF in (TEST_FRAMES, TEST_FRAMES_STK): + # values are numbers + properties = {"name": {"target": "atom", "values": [2, 3, 4]}} + data = create_input(frames=TF, properties=properties) + self.assertEqual(data["properties"]["name"]["target"], "atom") + self.assertEqual(data["properties"]["name"]["values"], [2, 3, 4]) + self.assertEqual(len(data["properties"]["name"].keys()), 2) + + # values are strings + properties = {"name": {"target": "atom", "values": ["2", "3", "4"]}} + data = create_input(frames=TF, properties=properties) + self.assertEqual(data["properties"]["name"]["target"], "atom") + self.assertEqual(data["properties"]["name"]["values"], ["2", "3", "4"]) + self.assertEqual(len(data["properties"]["name"].keys()), 2) + + properties = { + "name": { + "target": "atom", + "values": [2, 3, 4], + "description": "foo", + }, + } + data = create_input(frames=TF, properties=properties) + self.assertEqual(data["properties"]["name"]["target"], "atom") + self.assertEqual(data["properties"]["name"]["description"], "foo") + self.assertEqual(data["properties"]["name"]["values"], [2, 3, 4]) + self.assertEqual(len(data["properties"]["name"].keys()), 3) + + properties = { + "name": { + "target": "atom", + "values": [2, 3, 4], + "units": "foo", + }, + } + data = create_input(frames=TF, properties=properties) + self.assertEqual(data["properties"]["name"]["target"], "atom") + self.assertEqual(data["properties"]["name"]["units"], "foo") + self.assertEqual(data["properties"]["name"]["values"], [2, 3, 4]) + self.assertEqual(len(data["properties"]["name"].keys()), 3) def test_ndarray_properties(self): - # shape N - properties = {"name": {"target": "atom", "values": np.array([2, 3, 4])}} - data = create_input(frames=TEST_FRAMES, properties=properties) - self.assertEqual(data["properties"]["name"]["target"], "atom") - self.assertEqual(data["properties"]["name"]["values"], [2, 3, 4]) - self.assertEqual(len(data["properties"].keys()), 1) - - # shape N - properties = {"name": {"target": "atom", "values": np.array(["2", "3", "4"])}} - data = create_input(frames=TEST_FRAMES, properties=properties) - self.assertEqual(data["properties"]["name"]["target"], "atom") - self.assertEqual(data["properties"]["name"]["values"], ["2", "3", "4"]) - self.assertEqual(len(data["properties"].keys()), 1) - - # shape N x 1 - properties = {"name": {"target": "atom", "values": np.array([[2], [3], [4]])}} - data = create_input(frames=TEST_FRAMES, properties=properties) - self.assertEqual(data["properties"]["name"]["target"], "atom") - self.assertEqual(data["properties"]["name"]["values"], [2, 3, 4]) - self.assertEqual(len(data["properties"].keys()), 1) - - # shape N x 3 - properties = { - "name": { - "target": "atom", - "values": np.array([[1, 2, 4], [1, 2, 4], [1, 2, 4]]), + for TF in (TEST_FRAMES, TEST_FRAMES_STK): + # shape N + properties = {"name": {"target": "atom", "values": np.array([2, 3, 4])}} + data = create_input(frames=TF, properties=properties) + self.assertEqual(data["properties"]["name"]["target"], "atom") + self.assertEqual(data["properties"]["name"]["values"], [2, 3, 4]) + self.assertEqual(len(data["properties"].keys()), 1) + + # shape N + properties = { + "name": {"target": "atom", "values": np.array(["2", "3", "4"])} } - } - data = create_input(frames=TEST_FRAMES, properties=properties) - self.assertEqual(data["properties"]["name[1]"]["target"], "atom") - self.assertEqual(data["properties"]["name[1]"]["values"], [1, 1, 1]) - self.assertEqual(data["properties"]["name[2]"]["target"], "atom") - self.assertEqual(data["properties"]["name[2]"]["values"], [2, 2, 2]) - self.assertEqual(data["properties"]["name[3]"]["target"], "atom") - self.assertEqual(data["properties"]["name[3]"]["values"], [4, 4, 4]) - self.assertEqual(len(data["properties"].keys()), 3) + data = create_input(frames=TF, properties=properties) + self.assertEqual(data["properties"]["name"]["target"], "atom") + self.assertEqual(data["properties"]["name"]["values"], ["2", "3", "4"]) + self.assertEqual(len(data["properties"].keys()), 1) + + # shape N x 1 + properties = { + "name": {"target": "atom", "values": np.array([[2], [3], [4]])} + } + data = create_input(frames=TF, properties=properties) + self.assertEqual(data["properties"]["name"]["target"], "atom") + self.assertEqual(data["properties"]["name"]["values"], [2, 3, 4]) + self.assertEqual(len(data["properties"].keys()), 1) + + # shape N x 3 + properties = { + "name": { + "target": "atom", + "values": np.array([[1, 2, 4], [1, 2, 4], [1, 2, 4]]), + } + } + data = create_input(frames=TF, properties=properties) + self.assertEqual(data["properties"]["name[1]"]["target"], "atom") + self.assertEqual(data["properties"]["name[1]"]["values"], [1, 1, 1]) + self.assertEqual(data["properties"]["name[2]"]["target"], "atom") + self.assertEqual(data["properties"]["name[2]"]["values"], [2, 2, 2]) + self.assertEqual(data["properties"]["name[3]"]["target"], "atom") + self.assertEqual(data["properties"]["name[3]"]["values"], [4, 4, 4]) + self.assertEqual(len(data["properties"].keys()), 3) def test_shortened_properties(self): - # atom property - properties = {"name": [2, 3, 4]} - data = create_input(frames=TEST_FRAMES, properties=properties) - self.assertEqual(data["properties"]["name"]["target"], "atom") - self.assertEqual(data["properties"]["name"]["values"], [2, 3, 4]) - self.assertEqual(len(data["properties"]["name"].keys()), 2) - - # frame property - properties = {"name": [2]} - data = create_input(frames=TEST_FRAMES, properties=properties) - self.assertEqual(data["properties"]["name"]["target"], "structure") - self.assertEqual(data["properties"]["name"]["values"], [2]) - self.assertEqual(len(data["properties"]["name"].keys()), 2) - - # ndarray frame property - properties = {"name": np.array([[2, 4]])} - data = create_input(frames=TEST_FRAMES, properties=properties) - self.assertEqual(data["properties"]["name[1]"]["target"], "structure") - self.assertEqual(data["properties"]["name[1]"]["values"], [2]) - self.assertEqual(len(data["properties"]["name[1]"].keys()), 2) - - self.assertEqual(data["properties"]["name[2]"]["target"], "structure") - self.assertEqual(data["properties"]["name[2]"]["values"], [4]) - self.assertEqual(len(data["properties"]["name[2]"].keys()), 2) - - # the initial properties object must not be changed - self.assertEqual(type(properties["name"]), np.ndarray) + for TF in (TEST_FRAMES, TEST_FRAMES_STK): + # atom property + properties = {"name": [2, 3, 4]} + data = create_input(frames=TF, properties=properties) + self.assertEqual(data["properties"]["name"]["target"], "atom") + self.assertEqual(data["properties"]["name"]["values"], [2, 3, 4]) + self.assertEqual(len(data["properties"]["name"].keys()), 2) + + # frame property + properties = {"name": [2]} + data = create_input(frames=TF, properties=properties) + self.assertEqual(data["properties"]["name"]["target"], "structure") + self.assertEqual(data["properties"]["name"]["values"], [2]) + self.assertEqual(len(data["properties"]["name"].keys()), 2) + + # ndarray frame property + properties = {"name": np.array([[2, 4]])} + data = create_input(frames=TF, properties=properties) + self.assertEqual(data["properties"]["name[1]"]["target"], "structure") + self.assertEqual(data["properties"]["name[1]"]["values"], [2]) + self.assertEqual(len(data["properties"]["name[1]"].keys()), 2) + + self.assertEqual(data["properties"]["name[2]"]["target"], "structure") + self.assertEqual(data["properties"]["name[2]"]["values"], [4]) + self.assertEqual(len(data["properties"]["name[2]"].keys()), 2) + + # the initial properties object must not be changed + self.assertEqual(type(properties["name"]), np.ndarray) def test_shortened_properties_errors(self): - properties = {"name": ["2", "3"]} - with self.assertRaises(ValueError) as cm: - create_input(frames=TEST_FRAMES, properties=properties) - self.assertEqual( - str(cm.exception), - "The length of property values is different from the number of " - "structures and the number of atoms, we can not guess the target. " - "Got n_atoms = 3, n_structures = 1, the length of property values " - "is 2, for the 'name' property", - ) + for TF in (TEST_FRAMES, TEST_FRAMES_STK): + properties = {"name": ["2", "3"]} + with self.assertRaises(ValueError) as cm: + create_input(frames=TF, properties=properties) + self.assertEqual( + str(cm.exception), + "The length of property values is different from the number of " + "structures and the number of atoms, we can not guess the target. " + "Got n_atoms = 3, n_structures = 1, the length of property values " + "is 2, for the 'name' property", + ) - properties = {"name": ase.Atoms("CO2")} - with self.assertRaises(ValueError) as cm: - create_input(frames=TEST_FRAMES, properties=properties) - self.assertEqual( - str(cm.exception), - "Property values should be either list or numpy array, got " - " instead", - ) + properties = {"name": ase.Atoms("CO2")} + with self.assertRaises(ValueError) as cm: + create_input(frames=TF, properties=properties) + self.assertEqual( + str(cm.exception), + "Property values should be either list or numpy array, got " + " instead", + ) - properties = {"name": ["2", "3"]} - frames_single_atoms = [ase.Atoms("C"), ase.Atoms("H")] - with self.assertWarns(UserWarning) as cm: - data = create_input(frames=frames_single_atoms, properties=properties) + properties = {"name": ["2", "3"]} + frames_single_atoms = [ase.Atoms("C"), ase.Atoms("H")] + with self.assertWarns(UserWarning) as cm: + data = create_input(frames=frames_single_atoms, properties=properties) - self.assertEqual(data["properties"]["name"]["target"], "structure") + self.assertEqual(data["properties"]["name"]["target"], "structure") - self.assertEqual( - cm.warning.args[0], - "The target of the property 'name' is ambiguous because there is the same " - "number of atoms and structures. We will assume target=structure", - ) + self.assertEqual( + cm.warning.args[0], + "The target of the property 'name' is ambiguous because there " + "is the same number of atoms and structures. We will assume " + "target=structure", + ) def test_invalid_name(self): - properties = {"": {"target": "atom", "values": [2, 3, 4]}} - with self.assertRaises(Exception) as cm: - create_input(frames=TEST_FRAMES, properties=properties) - self.assertEqual( - str(cm.exception), "the name of a property can not be the empty string" - ) + for TF in (TEST_FRAMES, TEST_FRAMES_STK): + properties = {"": {"target": "atom", "values": [2, 3, 4]}} + with self.assertRaises(Exception) as cm: + create_input(frames=TF, properties=properties) + self.assertEqual( + str(cm.exception), + "the name of a property can not be the empty string", + ) - properties = {False: {"target": "atom", "values": [2, 3, 4]}} - with self.assertRaises(Exception) as cm: - create_input(frames=TEST_FRAMES, properties=properties) - self.assertEqual( - str(cm.exception), - "the name of a property name must be a string, " - "got 'False' of type ", - ) + properties = {False: {"target": "atom", "values": [2, 3, 4]}} + with self.assertRaises(Exception) as cm: + create_input(frames=TF, properties=properties) + self.assertEqual( + str(cm.exception), + "the name of a property name must be a string, " + "got 'False' of type ", + ) def test_invalid_target(self): - properties = {"name": {"values": [2, 3, 4]}} - with self.assertRaises(Exception) as cm: - create_input(frames=TEST_FRAMES, properties=properties) - self.assertEqual(str(cm.exception), "missing 'target' for the 'name' property") + for TF in (TEST_FRAMES, TEST_FRAMES_STK): + properties = {"name": {"values": [2, 3, 4]}} + with self.assertRaises(Exception) as cm: + create_input(frames=TF, properties=properties) + self.assertEqual( + str(cm.exception), "missing 'target' for the 'name' property" + ) - properties = {"name": {"target": "atoms", "values": [2, 3, 4]}} - with self.assertRaises(Exception) as cm: - create_input(frames=TEST_FRAMES, properties=properties) - self.assertEqual( - str(cm.exception), - "the target must be 'atom' or 'structure' for the 'name' property", - ) + properties = {"name": {"target": "atoms", "values": [2, 3, 4]}} + with self.assertRaises(Exception) as cm: + create_input(frames=TF, properties=properties) + self.assertEqual( + str(cm.exception), + "the target must be 'atom' or 'structure' for the 'name' property", + ) def test_invalid_types_metadata(self): - properties = {"name": {"target": "atom", "values": [2, 3, 4], "units": False}} - data = create_input(frames=TEST_FRAMES, properties=properties) - self.assertEqual(data["properties"]["name"]["units"], "False") + for TF in (TEST_FRAMES, TEST_FRAMES_STK): + properties = { + "name": {"target": "atom", "values": [2, 3, 4], "units": False} + } + data = create_input(frames=TF, properties=properties) + self.assertEqual(data["properties"]["name"]["units"], "False") - properties = { - "name": {"target": "atom", "values": [2, 3, 4], "description": False} - } - data = create_input(frames=TEST_FRAMES, properties=properties) - self.assertEqual(data["properties"]["name"]["description"], "False") + properties = { + "name": {"target": "atom", "values": [2, 3, 4], "description": False} + } + data = create_input(frames=TF, properties=properties) + self.assertEqual(data["properties"]["name"]["description"], "False") def test_property_unknown_keys_warning(self): - properties = {"name": {"target": "atom", "values": [2, 3, 4], "what": False}} - with self.assertWarns(UserWarning) as cm: - create_input(frames=TEST_FRAMES, properties=properties) - self.assertEqual(str(cm.warning), "ignoring unexpected property key: what") + for TF in (TEST_FRAMES, TEST_FRAMES_STK): + properties = { + "name": {"target": "atom", "values": [2, 3, 4], "what": False} + } + with self.assertWarns(UserWarning) as cm: + create_input(frames=TF, properties=properties) + self.assertEqual(str(cm.warning), "ignoring unexpected property key: what") def test_invalid_values_types(self): - properties = {"name": {"target": "atom", "values": 3}} - with self.assertRaises(Exception) as cm: - create_input(frames=TEST_FRAMES, properties=properties) - self.assertEqual( - str(cm.exception), "unknown type () for property 'name'" - ) + for TF in (TEST_FRAMES, TEST_FRAMES_STK): + properties = {"name": {"target": "atom", "values": 3}} + with self.assertRaises(Exception) as cm: + create_input(frames=TF, properties=properties) + self.assertEqual( + str(cm.exception), "unknown type () for property 'name'" + ) - properties = {"name": {"target": "atom", "values": {"test": "bad"}}} - with self.assertRaises(Exception) as cm: - create_input(frames=TEST_FRAMES, properties=properties) - self.assertEqual( - str(cm.exception), "unknown type () for property 'name'" - ) + properties = {"name": {"target": "atom", "values": {"test": "bad"}}} + with self.assertRaises(Exception) as cm: + create_input(frames=TF, properties=properties) + self.assertEqual( + str(cm.exception), "unknown type () for property 'name'" + ) - properties = {"name": {"target": "atom", "values": [{}, {}, {}]}} - with self.assertRaises(Exception) as cm: - create_input(frames=TEST_FRAMES, properties=properties) - self.assertEqual( - str(cm.exception), - "unsupported type in property 'name' values: should be string or number", - ) + properties = {"name": {"target": "atom", "values": [{}, {}, {}]}} + with self.assertRaises(Exception) as cm: + create_input(frames=TF, properties=properties) + self.assertEqual( + str(cm.exception), + "unsupported type in property 'name' values: should be string" + " or number", + ) def test_wrong_number_of_values(self): - properties = {"name": {"target": "atom", "values": [2, 3]}} - environments = [(0, 0, 3), (0, 1, 3), (0, 2, 3)] - with self.assertRaises(Exception) as cm: - create_input( - frames=TEST_FRAMES, properties=properties, environments=environments + for TF in (TEST_FRAMES, TEST_FRAMES_STK): + properties = {"name": {"target": "atom", "values": [2, 3]}} + environments = [(0, 0, 3), (0, 1, 3), (0, 2, 3)] + with self.assertRaises(Exception) as cm: + create_input( + frames=TF, properties=properties, environments=environments + ) + self.assertEqual( + str(cm.exception), + "wrong size for the property 'name' with target=='atom': " + "expected 3 values, got 2", ) - self.assertEqual( - str(cm.exception), - "wrong size for the property 'name' with target=='atom': " - "expected 3 values, got 2", - ) - properties = {"name": {"target": "structure", "values": [2, 3, 5]}} - with self.assertRaises(Exception) as cm: - create_input(frames=TEST_FRAMES, properties=properties) - self.assertEqual( - str(cm.exception), - "wrong size for the property 'name' with target=='structure': " - "expected 1 values, got 3", - ) + properties = {"name": {"target": "structure", "values": [2, 3, 5]}} + with self.assertRaises(Exception) as cm: + create_input(frames=TF, properties=properties) + self.assertEqual( + str(cm.exception), + "wrong size for the property 'name' with target=='structure': " + "expected 1 values, got 3", + ) def test_property_only(self): properties = {"name": [2, 3, 4]} @@ -358,25 +389,27 @@ def test_property_only(self): class TestCreateInputEnvironments(unittest.TestCase): def test_manual_environments_list(self): - environments = [ - (0, 0, 3.5), - (1, 1, 2.5), - (1, 2, 3), - ] - data = create_input(frames=TEST_FRAMES + TEST_FRAMES, environments=environments) - self.assertEqual(len(data["environments"]), 3) - - for i, env in enumerate(data["environments"]): - self.assertEqual(env["structure"], environments[i][0]) - self.assertEqual(env["center"], environments[i][1]) - self.assertEqual(env["cutoff"], environments[i][2]) + for TF in (TEST_FRAMES, TEST_FRAMES_STK): + environments = [ + (0, 0, 3.5), + (1, 1, 2.5), + (1, 2, 3), + ] + data = create_input(frames=TF + TF, environments=environments) + self.assertEqual(len(data["environments"]), 3) + + for i, env in enumerate(data["environments"]): + self.assertEqual(env["structure"], environments[i][0]) + self.assertEqual(env["center"], environments[i][1]) + self.assertEqual(env["cutoff"], environments[i][2]) def test_all_environments(self): - environments = all_atomic_environments(TEST_FRAMES, cutoff=6) - for i, (structure, center, cutoff) in enumerate(environments): - self.assertEqual(structure, 0) - self.assertEqual(center, i) - self.assertEqual(cutoff, 6) + for TF in (TEST_FRAMES, TEST_FRAMES_STK): + environments = all_atomic_environments(TF, cutoff=6) + for i, (structure, center, cutoff) in enumerate(environments): + self.assertEqual(structure, 0) + self.assertEqual(center, i) + self.assertEqual(cutoff, 6) if __name__ == "__main__": diff --git a/python/tests/stk_structures.py b/python/tests/stk_structures.py new file mode 100644 index 000000000..844aeb711 --- /dev/null +++ b/python/tests/stk_structures.py @@ -0,0 +1,143 @@ +import unittest + +import stk + +import chemiscope + +BASE_FRAME = stk.BuildingBlock("N#CC") + + +class TestStructures(unittest.TestCase): + """Conversion of structure data to chemiscope JSON""" + + def test_structures(self): + data = chemiscope.create_input(BASE_FRAME) + self.assertEqual(len(data["structures"]), 1) + self.assertEqual(data["structures"][0]["size"], 6) + self.assertEqual( + data["structures"][0]["names"], + ["N", "C", "C", "H", "H", "H"], + ) + self.assertEqual( + data["structures"][0]["x"], + [ + 1.6991195138834223, + 0.7737143493209756, + -0.41192204250544034, + -0.7778845126633998, + -1.1777543806588109, + -0.10527292738297804, + ], + ) + self.assertEqual( + data["structures"][0]["y"], + [ + -1.2265369887154756, + -0.5721898035707434, + 0.28832060028277334, + 0.6076276888433211, + -0.27163665176706653, + 1.1744151549238042, + ], + ) + self.assertEqual( + data["structures"][0]["z"], + [ + -0.19321573000005213, + -0.10192268845612924, + 0.03435599430880268, + -0.9630155400427929, + 0.6165952621860082, + 0.6072027020039786, + ], + ) + self.assertEqual(data["structures"][0].get("cell"), None) + + # Not testing cell because stk implementation does not have that yet. + + frame = BASE_FRAME.clone() + data = chemiscope.create_input([frame]) + self.assertEqual(len(data["structures"]), 1) + self.assertEqual(data["structures"][0]["size"], 6) + self.assertEqual( + data["structures"][0]["names"], + ["N", "C", "C", "H", "H", "H"], + ) + self.assertEqual( + data["structures"][0]["x"], + [ + 1.6991195138834223, + 0.7737143493209756, + -0.41192204250544034, + -0.7778845126633998, + -1.1777543806588109, + -0.10527292738297804, + ], + ) + self.assertEqual( + data["structures"][0]["y"], + [ + -1.2265369887154756, + -0.5721898035707434, + 0.28832060028277334, + 0.6076276888433211, + -0.27163665176706653, + 1.1744151549238042, + ], + ) + self.assertEqual( + data["structures"][0]["z"], + [ + -0.19321573000005213, + -0.10192268845612924, + 0.03435599430880268, + -0.9630155400427929, + 0.6165952621860082, + 0.6072027020039786, + ], + ) + self.assertEqual(data["structures"][0].get("cell"), None) + + +class TestExtractProperties(unittest.TestCase): + """Properties extraction""" + + def test_exception(self): + with self.assertRaises(RuntimeError): + chemiscope.extract_properties(BASE_FRAME) + + +class TestCompositionProperties(unittest.TestCase): + """Composition properties""" + + def test_composition(self): + properties = chemiscope.composition_properties([BASE_FRAME, BASE_FRAME]) + + self.assertEqual(len(properties.keys()), 6) + + self.assertEqual(properties["composition"]["target"], "structure") + self.assertEqual(properties["composition"]["values"], ["C2H3N1", "C2H3N1"]) + + self.assertEqual(properties["n_C"]["target"], "structure") + self.assertEqual(properties["n_C"]["values"], [2, 2]) + + self.assertEqual(properties["n_N"]["target"], "structure") + self.assertEqual(properties["n_N"]["values"], [1, 1]) + + self.assertEqual(properties["n_H"]["target"], "structure") + self.assertEqual(properties["n_H"]["values"], [3, 3]) + + self.assertEqual(properties["symbol"]["target"], "atom") + self.assertEqual( + properties["symbol"]["values"], + ["N", "C", "C", "H", "H", "H", "N", "C", "C", "H", "H", "H"], + ) + + self.assertEqual(properties["number"]["target"], "atom") + self.assertEqual( + properties["number"]["values"], [7, 6, 6, 1, 1, 1, 7, 6, 6, 1, 1, 1] + ) + + +if __name__ == "__main__": + unittest.main() diff --git a/python/tests/write_input.py b/python/tests/write_input.py index 193d95e96..55cf17543 100644 --- a/python/tests/write_input.py +++ b/python/tests/write_input.py @@ -4,10 +4,12 @@ import unittest import ase +import stk from chemiscope import write_input TEST_FRAMES = [ase.Atoms("CO2")] +TEST_FRAMES_STK = [stk.BuildingBlock("NCCN")] def is_gz_file(filepath): @@ -18,34 +20,37 @@ def is_gz_file(filepath): class TestWriteInput(unittest.TestCase): def test_file_path_as_dataset_name(self): - with tempfile.TemporaryDirectory() as dirname: - path = os.path.join(dirname, "test.json") - write_input(path, TEST_FRAMES) + for TF in (TEST_FRAMES, TEST_FRAMES_STK): + with tempfile.TemporaryDirectory() as dirname: + path = os.path.join(dirname, "test.json") + write_input(path, TF) - with open(path) as fd: - data = json.load(fd) + with open(path) as fd: + data = json.load(fd) - self.assertEqual(data["meta"]["name"], "test") + self.assertEqual(data["meta"]["name"], "test") def test_create_gz_file(self): - with tempfile.TemporaryDirectory() as dirname: - path = os.path.join(dirname, "test.json") - write_input(path, TEST_FRAMES) - self.assertFalse(is_gz_file(path)) + for TF in (TEST_FRAMES, TEST_FRAMES_STK): + with tempfile.TemporaryDirectory() as dirname: + path = os.path.join(dirname, "test.json") + write_input(path, TF) + self.assertFalse(is_gz_file(path)) - path = os.path.join(dirname, "test.json.gz") - write_input(path, TEST_FRAMES) - self.assertTrue(is_gz_file(path)) + path = os.path.join(dirname, "test.json.gz") + write_input(path, TF) + self.assertTrue(is_gz_file(path)) def test_wrong_path(self): - with tempfile.TemporaryDirectory() as dirname: - path = os.path.join(dirname, "test.tmp") - with self.assertRaises(Exception) as cm: - write_input(path, TEST_FRAMES) - - self.assertEqual( - str(cm.exception), "path should end with .json or .json.gz" - ) + for TF in (TEST_FRAMES, TEST_FRAMES_STK): + with tempfile.TemporaryDirectory() as dirname: + path = os.path.join(dirname, "test.tmp") + with self.assertRaises(Exception) as cm: + write_input(path, TF) + + self.assertEqual( + str(cm.exception), "path should end with .json or .json.gz" + ) if __name__ == "__main__": From ac40440e9f662f9695545b184657f9549d5ae63f Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Tue, 24 Sep 2024 17:27:01 +0200 Subject: [PATCH 09/35] Minor formatting. --- python/chemiscope/jupyter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/chemiscope/jupyter.py b/python/chemiscope/jupyter.py index d690190b7..2364a54e4 100644 --- a/python/chemiscope/jupyter.py +++ b/python/chemiscope/jupyter.py @@ -155,7 +155,7 @@ def show_input(path, mode="default"): try: meta = dict_input["meta"] - if meta is {"name": " "}: + if meta == {"name": " "}: has_metadata = False else: has_metadata = True From fccaf60bf0dde715c431c13f9229570e2e380240 Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Tue, 24 Sep 2024 17:27:23 +0200 Subject: [PATCH 10/35] Handle properties not in stk. --- python/chemiscope/input.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/python/chemiscope/input.py b/python/chemiscope/input.py index 3b5a4060a..4c9490b7a 100644 --- a/python/chemiscope/input.py +++ b/python/chemiscope/input.py @@ -2,6 +2,7 @@ """ Generate JSON input files for the default chemiscope visualizer. """ + import gzip import json import os @@ -10,6 +11,7 @@ import numpy as np from .structures import ( + _guess_adapter, _list_atom_properties, _list_structure_properties, frames_to_json, @@ -282,6 +284,8 @@ def create_input( data["structures"] = frames_to_json(frames) n_structures = len(data["structures"]) n_atoms = sum(s["size"] for s in data["structures"]) + _, adapter = _guess_adapter(frames) + from_stk = True if adapter == "stk" else False else: n_atoms = 0 @@ -376,8 +380,10 @@ def create_input( # Check to tell the user they might have forgotten some properties coming # from the frames (that chemiscope used to automatically extract). This code # should be removed in version 0.6 of chemiscope. - if frames is not None: + # stk cannot have atom properties or structure properties, so skipping. + if frames is not None and not from_stk: found_one_from_frame = False + atom_properties = _list_atom_properties(frames) for name in atom_properties: if name in data["properties"]: From 86f2bf41a320effe59d9401934a70e103d055469 Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Tue, 24 Sep 2024 17:27:37 +0200 Subject: [PATCH 11/35] Import necessary code. --- python/chemiscope/structures/__init__.py | 44 ++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/python/chemiscope/structures/__init__.py b/python/chemiscope/structures/__init__.py index ca8041ee9..28124eebb 100644 --- a/python/chemiscope/structures/__init__.py +++ b/python/chemiscope/structures/__init__.py @@ -20,6 +20,13 @@ ase_tensors_to_ellipsoids, ase_vectors_to_arrows, ) +from ._stk import ( + _stk_valid_structures, + _stk_to_json, + convert_stk_bonds_as_shapes, + _stk_all_atomic_environments, + _stk_composition_properties, +) __all__ = [ "convert_stk_bonds_as_shapes", @@ -32,9 +39,16 @@ def _guess_adapter(frames): frames as a list and a string describing which adapter should be used. """ - ase_frames, use_ase = _ase_valid_structures(frames) - if use_ase: - return ase_frames, "ASE" + try: + ase_frames, use_ase = _ase_valid_structures(frames) + if use_ase: + return ase_frames, "ASE" + except TypeError: + # Error associated with it being an stk list. + pass + stk_frames, use_stk = _stk_valid_structures(frames) + if use_stk: + return stk_frames, "stk" raise Exception(f"unknown frame type: '{frames[0].__class__.__name__}'") @@ -52,6 +66,8 @@ def frames_to_json(frames): if adapter == "ASE": return [_ase_to_json(frame) for frame in frames] + elif adapter == "stk": + return [_stk_to_json(frame) for frame in frames] else: raise Exception("reached unreachable code") @@ -66,6 +82,10 @@ def _list_atom_properties(frames): if adapter == "ASE": return _ase_list_atom_properties(frames) + elif adapter == "stk": + # Do not check, because stk does not contain its own properties + # and a dictionary must be added. + pass else: raise Exception("reached unreachable code") @@ -80,6 +100,10 @@ def _list_structure_properties(frames): if adapter == "ASE": return _ase_list_structure_properties(frames) + elif adapter == "stk": + # Do not check, because stk does not contain its own properties + # and a dictionary must be added. + pass else: raise Exception("reached unreachable code") @@ -100,6 +124,14 @@ def extract_properties(frames, only=None, environments=None): if adapter == "ASE": return _ase_extract_properties(frames, only, environments) + + elif adapter == "stk": + msg = ( + "stk molecules do not contain properties, you must write your " + "own dictionary as in example 8." + ) + raise RuntimeError(msg) + else: raise Exception("reached unreachable code") @@ -123,6 +155,10 @@ def composition_properties(frames, environments=None): if adapter == "ASE": return _ase_composition_properties(frames, environments) + + elif adapter == "stk": + return _stk_composition_properties(frames, environments) + else: raise Exception("reached unreachable code") @@ -141,6 +177,8 @@ def all_atomic_environments(frames, cutoff=3.5): if adapter == "ASE": return _ase_all_atomic_environments(frames, cutoff) + elif adapter == "stk": + return _stk_all_atomic_environments(frames, cutoff) else: raise Exception("reached unreachable code") From 77029bac893f7a8321cd52b252777b6c383cd330 Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Tue, 24 Sep 2024 17:28:00 +0200 Subject: [PATCH 12/35] Write all stk handling functions. --- python/chemiscope/structures/_stk.py | 103 +++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) diff --git a/python/chemiscope/structures/_stk.py b/python/chemiscope/structures/_stk.py index a406dd537..6c6d6b80e 100644 --- a/python/chemiscope/structures/_stk.py +++ b/python/chemiscope/structures/_stk.py @@ -1,3 +1,4 @@ +from collections import Counter try: import stk @@ -7,6 +8,108 @@ HAVE_STK = False +def _stk_valid_structures( + frames: stk.Molecule | list[stk.Molecule], +) -> tuple[list[stk.Molecule], bool]: + if HAVE_STK and isinstance(frames, stk.Molecule): + # deal with the user passing a single frame + return [frames], True + elif HAVE_STK and isinstance(frames[0], stk.Molecule): + for frame in frames: + assert isinstance(frame, stk.Molecule) + return frames, True + else: + return frames, False + + +def _stk_to_json(molecule: stk.Molecule) -> dict[str : int | list]: + """Implementation of frame_to_json for stk.Molcule. + + The current implementation assumes no periodic information, which is safe + for the majority of stk molecules. If necessary, we can add cell information + in the future. + + """ + pos_mat = molecule.get_position_matrix() + data = {} + data["size"] = molecule.get_num_atoms() + data["names"] = [atom.__class__.__name__ for atom in molecule.get_atoms()] + data["x"] = [float(pos_mat[atom.get_id()][0]) for atom in molecule.get_atoms()] + data["y"] = [float(pos_mat[atom.get_id()][1]) for atom in molecule.get_atoms()] + data["z"] = [float(pos_mat[atom.get_id()][2]) for atom in molecule.get_atoms()] + + return data + + +def _stk_all_atomic_environments(frames, cutoff): + "Extract all atomic environments out of a set of ASE Atoms objects" + environments = [] + for structure_i, frame in enumerate(frames): + for atom in frame.get_atoms(): + environments.append((structure_i, atom.get_id(), cutoff)) + + return environments + + +def _stk_composition_properties(frames, environments=None): + all_elements = set() + for frame in frames: + all_elements.update([atom.__class__.__name__ for atom in frame.get_atoms()]) + all_elements = set(all_elements) + + composition = [] + elements_count = {element: [] for element in all_elements} + for frame in frames: + counter = Counter([atom.__class__.__name__ for atom in frame.get_atoms()]) + + composition.append("".join(f"{i}{counter[i]}" for i in sorted(counter))) + + dict_composition = dict(counter) + + for element in all_elements: + if element in dict_composition: + elements_count[element].append(dict_composition[element]) + else: + elements_count[element].append(0) + + properties = { + f"n_{element}": {"values": values, "target": "structure"} + for element, values in elements_count.items() + } + + properties["composition"] = {"values": composition, "target": "structure"} + + if environments is not None: + atoms_mask = [[False] * len(f) for f in frames] + for structure, center, _ in environments: + atoms_mask[structure][center] = True + else: + atoms_mask = None + + symbols = [] + numbers = [] + for i, frame in enumerate(frames): + if atoms_mask is None: + frame_symbols = [atom.__class__.__name__ for atom in frame.get_atoms()] + frame_numbers = [atom.get_atomic_number() for atom in frame.get_atoms()] + + else: + frame_symbols = [atom.__class__.__name__ for atom in frame.get_atoms()][ + atoms_mask[i] + ] + frame_numbers = [atom.get_atomic_number() for atom in frame.get_atoms()][ + atoms_mask[i] + ] + + symbols.extend(frame_symbols) + numbers.extend(frame_numbers) + + properties["symbol"] = {"values": symbols, "target": "atom"} + properties["number"] = {"values": numbers, "target": "atom"} + + return properties + + def convert_stk_bonds_as_shapes( frames: list[stk.Molecule], bond_color: str, From acb01ab5b2bb94578ed325fd759c598edc60d698 Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Tue, 24 Sep 2024 17:28:13 +0200 Subject: [PATCH 13/35] Add example output. --- python/examples/data/stk_0.mol | 37 ++++ python/examples/data/stk_1.mol | 176 ++++++++++++++++ python/examples/data/stk_2.mol | 272 ++++++++++++++++++++++++ python/examples/data/stk_3.mol | 365 +++++++++++++++++++++++++++++++++ python/examples/data/stk_4.mol | 44 ++++ 5 files changed, 894 insertions(+) create mode 100644 python/examples/data/stk_0.mol create mode 100644 python/examples/data/stk_1.mol create mode 100644 python/examples/data/stk_2.mol create mode 100644 python/examples/data/stk_3.mol create mode 100644 python/examples/data/stk_4.mol diff --git a/python/examples/data/stk_0.mol b/python/examples/data/stk_0.mol new file mode 100644 index 000000000..cd294ed00 --- /dev/null +++ b/python/examples/data/stk_0.mol @@ -0,0 +1,37 @@ + + RDKit 3D + + 0 0 0 0 0 0 0 0 0 0999 V3000 +M V30 BEGIN CTAB +M V30 COUNTS 12 11 0 0 0 +M V30 BEGIN ATOM +M V30 1 N -1.3789 -0.7953 0.3238 0 +M V30 2 C -0.6980 0.4411 0.5929 0 +M V30 3 C 0.4802 0.6365 -0.3568 0 +M V30 4 N 1.4531 -0.3716 -0.2778 0 +M V30 5 H -1.8591 -0.7562 -0.6012 0 +M V30 6 H -0.7320 -1.6254 0.3496 0 +M V30 7 H -0.3501 0.4675 1.6463 0 +M V30 8 H -1.4140 1.2621 0.3731 0 +M V30 9 H 0.0242 0.6054 -1.3880 0 +M V30 10 H 0.9168 1.6345 -0.1926 0 +M V30 11 H 1.4680 -1.1058 -0.9708 0 +M V30 12 H 2.0898 -0.3929 0.5016 0 +M V30 END ATOM +M V30 BEGIN BOND +M V30 1 1 1 2 +M V30 2 1 2 3 +M V30 3 1 3 4 +M V30 4 1 1 5 +M V30 5 1 1 6 +M V30 6 1 2 7 +M V30 7 1 2 8 +M V30 8 1 3 9 +M V30 9 1 3 10 +M V30 10 1 4 11 +M V30 11 1 4 12 +M V30 END BOND +M V30 END CTAB +M END + +$$$$ diff --git a/python/examples/data/stk_1.mol b/python/examples/data/stk_1.mol new file mode 100644 index 000000000..9b327414e --- /dev/null +++ b/python/examples/data/stk_1.mol @@ -0,0 +1,176 @@ + + RDKit 3D + + 0 0 0 0 0 0 0 0 0 0999 V3000 +M V30 BEGIN CTAB +M V30 COUNTS 80 82 0 0 0 +M V30 BEGIN ATOM +M V30 1 C -1.2556 -0.4225 4.0772 0 +M V30 2 C -0.0397 0.2975 4.5383 0 +M V30 3 C 1.1868 -0.4347 4.0772 0 +M V30 4 C -0.0576 1.6914 4.0772 0 +M V30 5 H -1.4528 -0.5880 3.0318 0 +M V30 6 H -0.0193 0.3109 5.6490 0 +M V30 7 H 1.3357 -0.5727 3.0009 0 +M V30 8 H 0.7275 2.4052 4.2944 0 +M V30 9 C -3.7498 -1.7805 0.1839 0 +M V30 10 C -3.7106 -1.7760 -1.3020 0 +M V30 11 C -3.7569 -0.3623 -1.8045 0 +M V30 12 C -2.5293 -2.4982 -1.7907 0 +M V30 13 H -2.9918 -1.2913 0.7714 0 +M V30 14 H -4.6098 -2.2967 -1.6952 0 +M V30 15 H -2.9577 0.3230 -1.5023 0 +M V30 16 H -2.2946 -2.6232 -2.8406 0 +M V30 17 C 3.6233 -2.0364 -0.2630 0 +M V30 18 C 3.5997 -2.0048 -1.7488 0 +M V30 19 C 2.3985 -2.7516 -2.2514 0 +M V30 20 C 3.6345 -0.6206 -2.2376 0 +M V30 21 H 2.8205 -1.6246 0.3245 0 +M V30 22 H 4.5003 -2.5231 -2.1420 0 +M V30 23 H 1.4054 -2.4023 -1.9492 0 +M V30 24 H 3.6254 -0.3549 -3.2875 0 +M V30 25 C -0.1654 5.0154 -0.1294 0 +M V30 26 C -0.1810 4.9791 -1.6153 0 +M V30 27 C 1.0664 4.3124 -2.1178 0 +M V30 28 C -1.3971 4.3173 -2.1040 0 +M V30 29 H -0.1207 4.1143 0.4581 0 +M V30 30 H -0.1824 6.0182 -2.0084 0 +M V30 31 H 1.2603 3.2776 -1.8156 0 +M V30 32 H -1.6227 4.1765 -3.1539 0 +M V30 33 N -2.4870 -1.4284 4.1027 0 +M V30 34 C -3.8743 -1.8020 4.1257 0 +M V30 35 C -4.1982 -2.7786 2.9988 0 +M V30 36 N -3.9500 -2.2731 1.7136 0 +M V30 37 H -4.5169 -0.9007 4.0487 0 +M V30 38 H -4.0476 -2.3537 5.0747 0 +M V30 39 H -3.5080 -3.6538 3.1720 0 +M V30 40 H -5.2394 -3.1223 3.1048 0 +M V30 41 N 2.4914 -1.4606 3.6815 0 +M V30 42 C 3.5084 -2.4755 3.7045 0 +M V30 43 C 4.5162 -2.2677 2.5777 0 +M V30 44 N 3.9544 -2.3053 1.2924 0 +M V30 45 H 3.0489 -3.4825 3.6273 0 +M V30 46 H 4.0728 -2.3500 4.6535 0 +M V30 47 H 4.9293 -1.2325 2.7510 0 +M V30 48 H 5.3343 -2.9978 2.6836 0 +M V30 49 N -0.0432 3.5590 3.9060 0 +M V30 50 C 0.3254 4.9476 3.9293 0 +M V30 51 C -0.3584 5.7156 2.8019 0 +M V30 52 N -0.0432 5.2483 1.5169 0 +M V30 53 H 1.4272 5.0547 3.8532 0 +M V30 54 H -0.0670 5.3731 4.8780 0 +M V30 55 H -1.4614 5.5543 2.9742 0 +M V30 56 H -0.1367 6.7895 2.9081 0 +M V30 57 N -1.5947 -3.7958 -2.6583 0 +M V30 58 C -0.8120 -4.5200 -3.6214 0 +M V30 59 C 0.5519 -4.8952 -3.0492 0 +M V30 60 N 1.3313 -3.7958 -2.6583 0 +M V30 61 H -0.6881 -3.9197 -4.5463 0 +M V30 62 H -1.3409 -5.4775 -3.8176 0 +M V30 63 H 0.3181 -5.5054 -2.1299 0 +M V30 64 H 1.0853 -5.5334 -3.7717 0 +M V30 65 N -4.0129 0.8090 -2.7690 0 +M V30 66 C -4.6181 2.0621 -3.1270 0 +M V30 67 C -3.5788 3.0371 -3.6728 0 +M V30 68 N -2.5499 3.3430 -2.7690 0 +M V30 69 H -5.1355 2.5040 -2.2505 0 +M V30 70 H -5.3215 1.8575 -3.9627 0 +M V30 71 H -3.1237 2.5043 -4.5568 0 +M V30 72 H -4.0872 3.9465 -4.0307 0 +M V30 73 N 3.8995 1.1677 -2.7340 0 +M V30 74 C 4.1353 2.2077 -3.6971 0 +M V30 75 C 3.7783 3.5765 -3.1249 0 +M V30 76 N 2.4365 3.7017 -2.7340 0 +M V30 77 H 3.5534 2.0149 -4.6220 0 +M V30 78 H 5.2290 2.2284 -3.8933 0 +M V30 79 H 4.4236 3.6791 -2.2055 0 +M V30 80 H 4.0643 4.3575 -3.8474 0 +M V30 END ATOM +M V30 BEGIN BOND +M V30 1 1 1 2 +M V30 2 1 2 3 +M V30 3 1 2 4 +M V30 4 1 1 5 +M V30 5 1 2 6 +M V30 6 1 3 7 +M V30 7 1 4 8 +M V30 8 1 9 10 +M V30 9 1 10 11 +M V30 10 1 10 12 +M V30 11 1 9 13 +M V30 12 1 10 14 +M V30 13 1 11 15 +M V30 14 1 12 16 +M V30 15 1 17 18 +M V30 16 1 18 19 +M V30 17 1 18 20 +M V30 18 1 17 21 +M V30 19 1 18 22 +M V30 20 1 19 23 +M V30 21 1 20 24 +M V30 22 1 25 26 +M V30 23 1 26 27 +M V30 24 1 26 28 +M V30 25 1 25 29 +M V30 26 1 26 30 +M V30 27 1 27 31 +M V30 28 1 28 32 +M V30 29 1 33 34 +M V30 30 1 34 35 +M V30 31 1 35 36 +M V30 32 1 34 37 +M V30 33 1 34 38 +M V30 34 1 35 39 +M V30 35 1 35 40 +M V30 36 1 41 42 +M V30 37 1 42 43 +M V30 38 1 43 44 +M V30 39 1 42 45 +M V30 40 1 42 46 +M V30 41 1 43 47 +M V30 42 1 43 48 +M V30 43 1 49 50 +M V30 44 1 50 51 +M V30 45 1 51 52 +M V30 46 1 50 53 +M V30 47 1 50 54 +M V30 48 1 51 55 +M V30 49 1 51 56 +M V30 50 1 57 58 +M V30 51 1 58 59 +M V30 52 1 59 60 +M V30 53 1 58 61 +M V30 54 1 58 62 +M V30 55 1 59 63 +M V30 56 1 59 64 +M V30 57 1 65 66 +M V30 58 1 66 67 +M V30 59 1 67 68 +M V30 60 1 66 69 +M V30 61 1 66 70 +M V30 62 1 67 71 +M V30 63 1 67 72 +M V30 64 1 73 74 +M V30 65 1 74 75 +M V30 66 1 75 76 +M V30 67 1 74 77 +M V30 68 1 74 78 +M V30 69 1 75 79 +M V30 70 1 75 80 +M V30 71 2 1 33 +M V30 72 2 9 36 +M V30 73 2 3 41 +M V30 74 2 17 44 +M V30 75 2 4 49 +M V30 76 2 25 52 +M V30 77 2 12 57 +M V30 78 2 19 60 +M V30 79 2 11 65 +M V30 80 2 28 68 +M V30 81 2 20 73 +M V30 82 2 27 76 +M V30 END BOND +M V30 END CTAB +M END + +$$$$ diff --git a/python/examples/data/stk_2.mol b/python/examples/data/stk_2.mol new file mode 100644 index 000000000..f0dfe7c02 --- /dev/null +++ b/python/examples/data/stk_2.mol @@ -0,0 +1,272 @@ + + RDKit 3D + + 0 0 0 0 0 0 0 0 0 0999 V3000 +M V30 BEGIN CTAB +M V30 COUNTS 122 136 0 0 0 +M V30 BEGIN ATOM +M V30 1 Pd 0.0000 6.7061 0.0000 0 CHG=2 +M V30 2 Pd 0.0000 -6.7061 0.0000 0 CHG=2 +M V30 3 C 14.6172 4.7881 -0.6066 0 +M V30 4 N 13.4123 4.8933 -0.0000 0 +M V30 5 C 12.9018 3.7993 0.5932 0 +M V30 6 C 13.5659 2.5874 0.5996 0 +M V30 7 C 14.7939 2.4749 -0.0171 0 +M V30 8 C 15.4939 1.1926 -0.0090 0 +M V30 9 C 16.8711 1.1292 -0.0077 0 +M V30 10 C 17.5565 -0.0840 0.0004 0 +M V30 11 C 16.8578 -1.2740 0.0075 0 +M V30 12 C 15.4780 -1.2425 0.0064 0 +M V30 13 C 14.7497 -2.4936 0.0146 0 +M V30 14 C 13.5220 -2.5919 0.6235 0 +M V30 15 C 12.8806 -3.8096 0.5967 0 +M V30 16 N 13.4123 -4.8933 0.0000 0 +M V30 17 C 14.6118 -4.8155 -0.6003 0 +M V30 18 C 15.2647 -3.6219 -0.5866 0 +M V30 19 C 14.8141 -0.0144 -0.0018 0 +M V30 20 C 15.3148 3.5984 -0.6246 0 +M V30 21 H 14.9944 5.6977 -1.0750 0 +M V30 22 H 11.9249 3.8319 1.1009 0 +M V30 23 H 13.1630 1.6997 1.0741 0 +M V30 24 H 17.4342 2.0590 -0.0132 0 +M V30 25 H 18.6349 -0.1061 0.0012 0 +M V30 26 H 17.3723 -2.2363 0.0139 0 +M V30 27 H 13.0431 -1.7455 1.1225 0 +M V30 28 H 11.9020 -3.9029 1.0772 0 +M V30 29 H 15.0316 -5.7081 -1.0820 0 +M V30 30 H 16.2391 -3.5986 -1.0858 0 +M V30 31 H 13.7460 0.0126 -0.0026 0 +M V30 32 H 16.2634 3.5747 -1.1195 0 +M V30 33 C 0.6066 4.7881 14.6172 0 +M V30 34 N 0.0000 4.8933 13.4123 0 +M V30 35 C -0.5932 3.7993 12.9018 0 +M V30 36 C -0.5996 2.5874 13.5659 0 +M V30 37 C 0.0171 2.4749 14.7939 0 +M V30 38 C 0.0090 1.1926 15.4939 0 +M V30 39 C 0.0077 1.1292 16.8711 0 +M V30 40 C -0.0004 -0.0840 17.5565 0 +M V30 41 C -0.0075 -1.2740 16.8578 0 +M V30 42 C -0.0064 -1.2425 15.4780 0 +M V30 43 C -0.0146 -2.4936 14.7497 0 +M V30 44 C -0.6235 -2.5919 13.5220 0 +M V30 45 C -0.5967 -3.8096 12.8806 0 +M V30 46 N 0.0000 -4.8933 13.4123 0 +M V30 47 C 0.6003 -4.8155 14.6118 0 +M V30 48 C 0.5866 -3.6219 15.2647 0 +M V30 49 C 0.0018 -0.0144 14.8141 0 +M V30 50 C 0.6246 3.5984 15.3148 0 +M V30 51 H 1.0750 5.6977 14.9944 0 +M V30 52 H -1.1009 3.8319 11.9249 0 +M V30 53 H -1.0741 1.6997 13.1630 0 +M V30 54 H 0.0132 2.0590 17.4342 0 +M V30 55 H -0.0012 -0.1061 18.6349 0 +M V30 56 H -0.0139 -2.2363 17.3723 0 +M V30 57 H -1.1225 -1.7455 13.0431 0 +M V30 58 H -1.0772 -3.9029 11.9020 0 +M V30 59 H 1.0820 -5.7081 15.0316 0 +M V30 60 H 1.0858 -3.5986 16.2391 0 +M V30 61 H 0.0026 0.0126 13.7460 0 +M V30 62 H 1.1195 3.5747 16.2634 0 +M V30 63 C -14.6172 4.7881 0.6066 0 +M V30 64 N -13.4123 4.8933 0.0000 0 +M V30 65 C -12.9018 3.7993 -0.5932 0 +M V30 66 C -13.5659 2.5874 -0.5996 0 +M V30 67 C -14.7939 2.4749 0.0171 0 +M V30 68 C -15.4939 1.1926 0.0090 0 +M V30 69 C -16.8711 1.1292 0.0077 0 +M V30 70 C -17.5565 -0.0840 -0.0004 0 +M V30 71 C -16.8578 -1.2740 -0.0075 0 +M V30 72 C -15.4780 -1.2425 -0.0064 0 +M V30 73 C -14.7497 -2.4936 -0.0146 0 +M V30 74 C -13.5220 -2.5919 -0.6235 0 +M V30 75 C -12.8806 -3.8096 -0.5967 0 +M V30 76 N -13.4123 -4.8933 -0.0000 0 +M V30 77 C -14.6118 -4.8155 0.6003 0 +M V30 78 C -15.2647 -3.6219 0.5866 0 +M V30 79 C -14.8141 -0.0144 0.0018 0 +M V30 80 C -15.3148 3.5984 0.6246 0 +M V30 81 H -14.9944 5.6977 1.0750 0 +M V30 82 H -11.9249 3.8319 -1.1009 0 +M V30 83 H -13.1630 1.6997 -1.0741 0 +M V30 84 H -17.4342 2.0590 0.0132 0 +M V30 85 H -18.6349 -0.1061 -0.0012 0 +M V30 86 H -17.3723 -2.2363 -0.0139 0 +M V30 87 H -13.0431 -1.7455 -1.1225 0 +M V30 88 H -11.9020 -3.9029 -1.0772 0 +M V30 89 H -15.0316 -5.7081 1.0820 0 +M V30 90 H -16.2391 -3.5986 1.0858 0 +M V30 91 H -13.7460 0.0126 0.0026 0 +M V30 92 H -16.2634 3.5747 1.1195 0 +M V30 93 C -0.6066 4.7881 -14.6172 0 +M V30 94 N -0.0000 4.8933 -13.4123 0 +M V30 95 C 0.5932 3.7993 -12.9018 0 +M V30 96 C 0.5996 2.5874 -13.5659 0 +M V30 97 C -0.0171 2.4749 -14.7939 0 +M V30 98 C -0.0090 1.1926 -15.4939 0 +M V30 99 C -0.0077 1.1292 -16.8711 0 +M V30 100 C 0.0004 -0.0840 -17.5565 0 +M V30 101 C 0.0075 -1.2740 -16.8578 0 +M V30 102 C 0.0064 -1.2425 -15.4780 0 +M V30 103 C 0.0146 -2.4936 -14.7497 0 +M V30 104 C 0.6235 -2.5919 -13.5220 0 +M V30 105 C 0.5967 -3.8096 -12.8806 0 +M V30 106 N -0.0000 -4.8933 -13.4123 0 +M V30 107 C -0.6003 -4.8155 -14.6118 0 +M V30 108 C -0.5866 -3.6219 -15.2647 0 +M V30 109 C -0.0018 -0.0144 -14.8141 0 +M V30 110 C -0.6246 3.5984 -15.3148 0 +M V30 111 H -1.0750 5.6977 -14.9944 0 +M V30 112 H 1.1009 3.8319 -11.9249 0 +M V30 113 H 1.0741 1.6997 -13.1630 0 +M V30 114 H -0.0132 2.0590 -17.4342 0 +M V30 115 H 0.0012 -0.1061 -18.6349 0 +M V30 116 H 0.0139 -2.2363 -17.3723 0 +M V30 117 H 1.1225 -1.7455 -13.0431 0 +M V30 118 H 1.0772 -3.9029 -11.9020 0 +M V30 119 H -1.0820 -5.7081 -15.0316 0 +M V30 120 H -1.0858 -3.5986 -16.2391 0 +M V30 121 H -0.0026 0.0126 -13.7460 0 +M V30 122 H -1.1195 3.5747 -16.2634 0 +M V30 END ATOM +M V30 BEGIN BOND +M V30 1 2 3 4 +M V30 2 1 4 5 +M V30 3 2 5 6 +M V30 4 1 6 7 +M V30 5 1 7 8 +M V30 6 2 8 9 +M V30 7 1 9 10 +M V30 8 2 10 11 +M V30 9 1 11 12 +M V30 10 1 12 13 +M V30 11 2 13 14 +M V30 12 1 14 15 +M V30 13 2 15 16 +M V30 14 1 16 17 +M V30 15 2 17 18 +M V30 16 2 12 19 +M V30 17 2 7 20 +M V30 18 1 20 3 +M V30 19 1 19 8 +M V30 20 1 18 13 +M V30 21 1 3 21 +M V30 22 1 5 22 +M V30 23 1 6 23 +M V30 24 1 9 24 +M V30 25 1 10 25 +M V30 26 1 11 26 +M V30 27 1 14 27 +M V30 28 1 15 28 +M V30 29 1 17 29 +M V30 30 1 18 30 +M V30 31 1 19 31 +M V30 32 1 20 32 +M V30 33 2 33 34 +M V30 34 1 34 35 +M V30 35 2 35 36 +M V30 36 1 36 37 +M V30 37 1 37 38 +M V30 38 2 38 39 +M V30 39 1 39 40 +M V30 40 2 40 41 +M V30 41 1 41 42 +M V30 42 1 42 43 +M V30 43 2 43 44 +M V30 44 1 44 45 +M V30 45 2 45 46 +M V30 46 1 46 47 +M V30 47 2 47 48 +M V30 48 2 42 49 +M V30 49 2 37 50 +M V30 50 1 50 33 +M V30 51 1 49 38 +M V30 52 1 48 43 +M V30 53 1 33 51 +M V30 54 1 35 52 +M V30 55 1 36 53 +M V30 56 1 39 54 +M V30 57 1 40 55 +M V30 58 1 41 56 +M V30 59 1 44 57 +M V30 60 1 45 58 +M V30 61 1 47 59 +M V30 62 1 48 60 +M V30 63 1 49 61 +M V30 64 1 50 62 +M V30 65 2 63 64 +M V30 66 1 64 65 +M V30 67 2 65 66 +M V30 68 1 66 67 +M V30 69 1 67 68 +M V30 70 2 68 69 +M V30 71 1 69 70 +M V30 72 2 70 71 +M V30 73 1 71 72 +M V30 74 1 72 73 +M V30 75 2 73 74 +M V30 76 1 74 75 +M V30 77 2 75 76 +M V30 78 1 76 77 +M V30 79 2 77 78 +M V30 80 2 72 79 +M V30 81 2 67 80 +M V30 82 1 80 63 +M V30 83 1 79 68 +M V30 84 1 78 73 +M V30 85 1 63 81 +M V30 86 1 65 82 +M V30 87 1 66 83 +M V30 88 1 69 84 +M V30 89 1 70 85 +M V30 90 1 71 86 +M V30 91 1 74 87 +M V30 92 1 75 88 +M V30 93 1 77 89 +M V30 94 1 78 90 +M V30 95 1 79 91 +M V30 96 1 80 92 +M V30 97 2 93 94 +M V30 98 1 94 95 +M V30 99 2 95 96 +M V30 100 1 96 97 +M V30 101 1 97 98 +M V30 102 2 98 99 +M V30 103 1 99 100 +M V30 104 2 100 101 +M V30 105 1 101 102 +M V30 106 1 102 103 +M V30 107 2 103 104 +M V30 108 1 104 105 +M V30 109 2 105 106 +M V30 110 1 106 107 +M V30 111 2 107 108 +M V30 112 2 102 109 +M V30 113 2 97 110 +M V30 114 1 110 93 +M V30 115 1 109 98 +M V30 116 1 108 103 +M V30 117 1 93 111 +M V30 118 1 95 112 +M V30 119 1 96 113 +M V30 120 1 99 114 +M V30 121 1 100 115 +M V30 122 1 101 116 +M V30 123 1 104 117 +M V30 124 1 105 118 +M V30 125 1 107 119 +M V30 126 1 108 120 +M V30 127 1 109 121 +M V30 128 1 110 122 +M V30 129 9 4 1 +M V30 130 9 34 1 +M V30 131 9 64 1 +M V30 132 9 94 1 +M V30 133 9 16 2 +M V30 134 9 46 2 +M V30 135 9 76 2 +M V30 136 9 106 2 +M V30 END BOND +M V30 END CTAB +M END + +$$$$ diff --git a/python/examples/data/stk_3.mol b/python/examples/data/stk_3.mol new file mode 100644 index 000000000..e6f366ee0 --- /dev/null +++ b/python/examples/data/stk_3.mol @@ -0,0 +1,365 @@ + + RDKit 3D + + 0 0 0 0 0 0 0 0 0 0999 V3000 +M V30 BEGIN CTAB +M V30 COUNTS 170 181 0 0 0 +M V30 BEGIN ATOM +M V30 1 C -2.5393 -1.2587 5.2649 0 +M V30 2 C -1.2725 -0.5338 5.2649 0 +M V30 3 C -1.2400 0.8527 5.2649 0 +M V30 4 C -0.0713 1.5643 5.2649 0 +M V30 5 C -0.0571 3.0229 5.2649 0 +M V30 6 C 1.0968 0.8497 5.2649 0 +M V30 7 C 1.1356 -0.5436 5.2649 0 +M V30 8 C 2.4110 -1.2491 5.2649 0 +M V30 9 C -0.0685 -1.1963 5.2649 0 +M V30 10 H -2.5200 -2.3313 5.2649 0 +M V30 11 H -2.1982 1.3669 5.2649 0 +M V30 12 H 0.8725 3.5663 5.2649 0 +M V30 13 H 2.0496 1.3873 5.2649 0 +M V30 14 H 3.3080 -0.6695 5.2649 0 +M V30 15 H -0.0712 -2.2788 5.2649 0 +M V30 16 C -5.3748 -3.1335 1.1212 0 +M V30 17 C -4.9564 -2.8854 -0.2548 0 +M V30 18 C -4.1559 -3.7909 -0.9350 0 +M V30 19 C -3.7450 -3.5906 -2.2247 0 +M V30 20 C -2.9029 -4.5548 -2.9239 0 +M V30 21 C -4.1576 -2.4398 -2.8415 0 +M V30 22 C -4.9620 -1.4885 -2.2165 0 +M V30 23 C -5.3693 -0.2819 -2.9252 0 +M V30 24 C -5.3388 -1.7486 -0.9256 0 +M V30 25 H -5.9941 -2.4073 1.6110 0 +M V30 26 H -3.8590 -4.6870 -0.3950 0 +M V30 27 H -2.5892 -4.3804 -3.9390 0 +M V30 28 H -3.8472 -2.2482 -3.8729 0 +M V30 29 H -5.0347 -0.1503 -3.9308 0 +M V30 30 H -5.9638 -1.0285 -0.4132 0 +M V30 31 C 5.1527 -2.9337 0.9085 0 +M V30 32 C 4.7285 -2.6954 -0.4675 0 +M V30 33 C 5.1125 -1.5494 -1.1476 0 +M V30 34 C 4.7336 -1.2937 -2.4373 0 +M V30 35 C 5.1475 -0.0823 -3.1365 0 +M V30 36 C 3.9433 -2.2264 -3.0541 0 +M V30 37 C 3.5217 -3.3987 -2.4291 0 +M V30 38 C 2.6803 -4.3547 -3.1378 0 +M V30 39 C 3.9353 -3.5950 -1.1382 0 +M V30 40 H 4.8334 -3.8332 1.3984 0 +M V30 41 H 5.7401 -0.8442 -0.6076 0 +M V30 42 H 4.8396 0.1022 -4.1517 0 +M V30 43 H 3.6221 -2.0534 -4.0856 0 +M V30 44 H 2.3991 -4.1307 -4.1435 0 +M V30 45 H 3.6242 -4.4963 -0.6258 0 +M V30 46 C 0.2771 5.8890 0.7434 0 +M V30 47 C 0.2828 5.4025 -0.6326 0 +M V30 48 C -0.9017 5.1620 -1.3128 0 +M V30 49 C -0.9336 4.7060 -2.6025 0 +M V30 50 C -2.1897 4.4588 -3.3017 0 +M V30 51 C 0.2693 4.4879 -3.2193 0 +M V30 52 C 1.4953 4.7089 -2.5943 0 +M V30 53 C 2.7439 4.4584 -3.3030 0 +M V30 54 C 1.4585 5.1653 -1.3034 0 +M V30 55 H 1.2157 6.0622 1.2332 0 +M V30 56 H -1.8262 5.3529 -0.7728 0 +M V30 57 H -2.1955 4.0999 -4.3168 0 +M V30 58 H 0.2800 4.1233 -4.2507 0 +M V30 59 H 2.6906 4.1028 -4.3086 0 +M V30 60 H 2.3946 5.3465 -0.7910 0 +M V30 61 N -3.9995 -2.4253 5.2236 0 +M V30 62 C -5.4158 -2.8155 5.1613 0 +M V30 63 C -5.7872 -3.2781 6.5523 0 +M V30 64 C -7.0619 -4.0595 6.5945 0 +M V30 65 C -7.7087 -3.9302 5.2113 0 +M V30 66 C -6.7934 -4.7174 4.2776 0 +M V30 67 C -5.5256 -3.8946 4.1338 0 +M V30 68 N -5.4752 -3.2773 2.8138 0 +M V30 69 H -5.9636 -1.8840 4.8745 0 +M V30 70 H -4.9665 -3.9451 6.8946 0 +M V30 71 H -5.9109 -2.3910 7.1992 0 +M V30 72 H -6.8650 -5.1557 6.7160 0 +M V30 73 H -7.7332 -3.7367 7.3959 0 +M V30 74 H -8.7057 -4.3809 5.2971 0 +M V30 75 H -7.7738 -2.8742 4.9264 0 +M V30 76 H -6.4844 -5.6625 4.7981 0 +M V30 77 H -7.2653 -4.9642 3.3285 0 +M V30 78 H -4.6072 -4.5426 4.1892 0 +M V30 79 N 3.6993 -2.3691 5.2408 0 +M V30 80 C 4.7456 -3.4002 5.1786 0 +M V30 81 C 5.3321 -3.4902 6.5695 0 +M V30 82 C 6.6464 -4.2031 6.6118 0 +M V30 83 C 6.8578 -4.8281 5.2286 0 +M V30 84 C 7.0815 -3.6419 4.2947 0 +M V30 85 C 5.7348 -2.9557 4.1510 0 +M V30 86 N 5.1750 -3.2210 2.8310 0 +M V30 87 H 4.2131 -4.3406 4.8920 0 +M V30 88 H 5.4991 -2.4458 6.9117 0 +M V30 89 H 4.6259 -4.0410 7.2166 0 +M V30 90 H 7.4971 -3.4842 6.7331 0 +M V30 91 H 6.7028 -4.9457 7.4132 0 +M V30 92 H 7.7469 -5.4658 5.3144 0 +M V30 93 H 5.9760 -5.4127 4.9439 0 +M V30 94 H 7.7453 -2.9015 4.8151 0 +M V30 95 H 7.5312 -3.9272 3.3456 0 +M V30 96 H 5.8365 -1.8363 4.2062 0 +M V30 97 N -0.2313 4.7317 4.6410 0 +M V30 98 C 0.1393 6.1533 4.5786 0 +M V30 99 C -0.0754 6.7063 5.9696 0 +M V30 100 C -0.1143 8.2010 6.0119 0 +M V30 101 C 0.3210 8.6963 4.6286 0 +M V30 102 C -0.8187 8.2975 3.6951 0 +M V30 103 C -0.7404 6.7881 3.5513 0 +M V30 104 N -0.2313 6.4357 2.2312 0 +M V30 105 H 1.2198 6.1618 4.2916 0 +M V30 106 H -1.0633 6.3292 6.3121 0 +M V30 107 H 0.7548 6.3696 6.6164 0 +M V30 108 H -1.1621 8.5787 6.1335 0 +M V30 109 H 0.5011 8.6207 6.8131 0 +M V30 110 H 0.4293 9.7851 4.7144 0 +M V30 111 H 1.2678 8.2245 4.3435 0 +M V30 112 H -1.7915 8.5026 4.2158 0 +M V30 113 H -0.7965 8.8296 2.7460 0 +M V30 114 H -1.7608 6.3169 3.6068 0 +M V30 115 N -1.5219 -5.3789 -3.4557 0 +M V30 116 C -0.6502 -6.0829 -4.4078 0 +M V30 117 C -1.4667 -7.2310 -4.9573 0 +M V30 118 C -0.6383 -8.2697 -5.6445 0 +M V30 119 C 0.7772 -7.6965 -5.7721 0 +M V30 120 C 1.3092 -7.6490 -4.3424 0 +M V30 121 C 0.5551 -6.5299 -3.6465 0 +M V30 122 N 1.4295 -5.3789 -3.4557 0 +M V30 123 H -0.4110 -5.3291 -5.1981 0 +M V30 124 H -1.9640 -7.7118 -4.0872 0 +M V30 125 H -2.1892 -6.8320 -5.6919 0 +M V30 126 H -0.5195 -9.1840 -5.0080 0 +M V30 127 H -1.0501 -8.5716 -6.6120 0 +M V30 128 H 1.3358 -8.4000 -6.4027 0 +M V30 129 H 0.7376 -6.7007 -6.2275 0 +M V30 130 H 1.0024 -8.5930 -3.8187 0 +M V30 131 H 2.3913 -7.5435 -4.2950 0 +M V30 132 H 0.2377 -6.8315 -2.6098 0 +M V30 133 N -5.2458 1.4088 -3.6806 0 +M V30 134 C -5.7902 2.7297 -4.0283 0 +M V30 135 C -6.9776 2.4724 -4.9287 0 +M V30 136 C -7.4236 3.6865 -5.6801 0 +M V30 137 C -6.6552 4.8773 -5.0970 0 +M V30 138 C -5.2077 4.6558 -5.5272 0 +M V30 139 C -4.6944 3.4888 -4.7029 0 +M V30 140 N -3.7701 3.9648 -3.6806 0 +M V30 141 H -6.0994 3.1844 -3.0548 0 +M V30 142 H -6.6539 1.7112 -5.6712 0 +M V30 143 H -7.8241 2.1269 -4.3083 0 +M V30 144 H -7.1073 3.6410 -6.7539 0 +M V30 145 H -8.5067 3.8363 -5.6435 0 +M V30 146 H -7.0934 5.7753 -5.5511 0 +M V30 147 H -6.7605 4.8923 -4.0066 0 +M V30 148 H -5.2049 4.3000 -6.5916 0 +M V30 149 H -4.5975 5.5531 -5.4435 0 +M V30 150 H -4.0930 2.7751 -5.3318 0 +M V30 151 N 5.7193 1.4642 -4.0422 0 +M V30 152 C 5.8932 2.5711 -4.9943 0 +M V30 153 C 7.2958 2.4380 -5.5438 0 +M V30 154 C 7.7810 3.6748 -6.2310 0 +M V30 155 C 6.5769 4.6140 -6.3587 0 +M V30 156 C 6.2698 5.0510 -4.9290 0 +M V30 157 C 5.6777 3.8384 -4.2331 0 +M V30 158 N 4.2436 4.0201 -4.0422 0 +M V30 159 H 5.1208 2.4013 -5.7847 0 +M V30 160 H 7.9608 2.2477 -4.6737 0 +M V30 161 H 7.3114 1.6128 -6.2785 0 +M V30 162 H 8.5135 4.2348 -5.5945 0 +M V30 163 H 8.2484 3.4691 -7.1986 0 +M V30 164 H 6.9069 5.4495 -6.9892 0 +M V30 165 H 5.7344 4.0818 -6.8141 0 +M V30 166 H 7.2407 5.2573 -4.4052 0 +M V30 167 H 5.6374 5.9354 -4.8815 0 +M V30 168 H 6.0976 3.7143 -3.1964 0 +M V30 169 Br 1.1870 0.0000 0.0000 0 +M V30 170 Br -1.1870 0.0000 0.0000 0 +M V30 END ATOM +M V30 BEGIN BOND +M V30 1 1 1 2 +M V30 2 2 2 3 +M V30 3 1 3 4 +M V30 4 1 4 5 +M V30 5 2 4 6 +M V30 6 1 6 7 +M V30 7 1 7 8 +M V30 8 2 7 9 +M V30 9 1 9 2 +M V30 10 1 1 10 +M V30 11 1 3 11 +M V30 12 1 5 12 +M V30 13 1 6 13 +M V30 14 1 8 14 +M V30 15 1 9 15 +M V30 16 1 16 17 +M V30 17 2 17 18 +M V30 18 1 18 19 +M V30 19 1 19 20 +M V30 20 2 19 21 +M V30 21 1 21 22 +M V30 22 1 22 23 +M V30 23 2 22 24 +M V30 24 1 24 17 +M V30 25 1 16 25 +M V30 26 1 18 26 +M V30 27 1 20 27 +M V30 28 1 21 28 +M V30 29 1 23 29 +M V30 30 1 24 30 +M V30 31 1 31 32 +M V30 32 2 32 33 +M V30 33 1 33 34 +M V30 34 1 34 35 +M V30 35 2 34 36 +M V30 36 1 36 37 +M V30 37 1 37 38 +M V30 38 2 37 39 +M V30 39 1 39 32 +M V30 40 1 31 40 +M V30 41 1 33 41 +M V30 42 1 35 42 +M V30 43 1 36 43 +M V30 44 1 38 44 +M V30 45 1 39 45 +M V30 46 1 46 47 +M V30 47 2 47 48 +M V30 48 1 48 49 +M V30 49 1 49 50 +M V30 50 2 49 51 +M V30 51 1 51 52 +M V30 52 1 52 53 +M V30 53 2 52 54 +M V30 54 1 54 47 +M V30 55 1 46 55 +M V30 56 1 48 56 +M V30 57 1 50 57 +M V30 58 1 51 58 +M V30 59 1 53 59 +M V30 60 1 54 60 +M V30 61 1 61 62 +M V30 62 1 62 63 +M V30 63 1 63 64 +M V30 64 1 64 65 +M V30 65 1 65 66 +M V30 66 1 66 67 +M V30 67 1 67 68 +M V30 68 1 67 62 +M V30 69 1 62 69 +M V30 70 1 63 70 +M V30 71 1 63 71 +M V30 72 1 64 72 +M V30 73 1 64 73 +M V30 74 1 65 74 +M V30 75 1 65 75 +M V30 76 1 66 76 +M V30 77 1 66 77 +M V30 78 1 67 78 +M V30 79 1 79 80 +M V30 80 1 80 81 +M V30 81 1 81 82 +M V30 82 1 82 83 +M V30 83 1 83 84 +M V30 84 1 84 85 +M V30 85 1 85 86 +M V30 86 1 85 80 +M V30 87 1 80 87 +M V30 88 1 81 88 +M V30 89 1 81 89 +M V30 90 1 82 90 +M V30 91 1 82 91 +M V30 92 1 83 92 +M V30 93 1 83 93 +M V30 94 1 84 94 +M V30 95 1 84 95 +M V30 96 1 85 96 +M V30 97 1 97 98 +M V30 98 1 98 99 +M V30 99 1 99 100 +M V30 100 1 100 101 +M V30 101 1 101 102 +M V30 102 1 102 103 +M V30 103 1 103 104 +M V30 104 1 103 98 +M V30 105 1 98 105 +M V30 106 1 99 106 +M V30 107 1 99 107 +M V30 108 1 100 108 +M V30 109 1 100 109 +M V30 110 1 101 110 +M V30 111 1 101 111 +M V30 112 1 102 112 +M V30 113 1 102 113 +M V30 114 1 103 114 +M V30 115 1 115 116 +M V30 116 1 116 117 +M V30 117 1 117 118 +M V30 118 1 118 119 +M V30 119 1 119 120 +M V30 120 1 120 121 +M V30 121 1 121 122 +M V30 122 1 121 116 +M V30 123 1 116 123 +M V30 124 1 117 124 +M V30 125 1 117 125 +M V30 126 1 118 126 +M V30 127 1 118 127 +M V30 128 1 119 128 +M V30 129 1 119 129 +M V30 130 1 120 130 +M V30 131 1 120 131 +M V30 132 1 121 132 +M V30 133 1 133 134 +M V30 134 1 134 135 +M V30 135 1 135 136 +M V30 136 1 136 137 +M V30 137 1 137 138 +M V30 138 1 138 139 +M V30 139 1 139 140 +M V30 140 1 139 134 +M V30 141 1 134 141 +M V30 142 1 135 142 +M V30 143 1 135 143 +M V30 144 1 136 144 +M V30 145 1 136 145 +M V30 146 1 137 146 +M V30 147 1 137 147 +M V30 148 1 138 148 +M V30 149 1 138 149 +M V30 150 1 139 150 +M V30 151 1 151 152 +M V30 152 1 152 153 +M V30 153 1 153 154 +M V30 154 1 154 155 +M V30 155 1 155 156 +M V30 156 1 156 157 +M V30 157 1 157 158 +M V30 158 1 157 152 +M V30 159 1 152 159 +M V30 160 1 153 160 +M V30 161 1 153 161 +M V30 162 1 154 162 +M V30 163 1 154 163 +M V30 164 1 155 164 +M V30 165 1 155 165 +M V30 166 1 156 166 +M V30 167 1 156 167 +M V30 168 1 157 168 +M V30 169 2 1 61 +M V30 170 2 16 68 +M V30 171 2 8 79 +M V30 172 2 31 86 +M V30 173 2 5 97 +M V30 174 2 46 104 +M V30 175 2 20 115 +M V30 176 2 38 122 +M V30 177 2 23 133 +M V30 178 2 50 140 +M V30 179 2 35 151 +M V30 180 2 53 158 +M V30 181 1 169 170 +M V30 END BOND +M V30 END CTAB +M END + +$$$$ diff --git a/python/examples/data/stk_4.mol b/python/examples/data/stk_4.mol new file mode 100644 index 000000000..7195b102e --- /dev/null +++ b/python/examples/data/stk_4.mol @@ -0,0 +1,44 @@ + + RDKit 3D + + 0 0 0 0 0 0 0 0 0 0999 V3000 +M V30 BEGIN CTAB +M V30 COUNTS 15 15 0 0 0 +M V30 BEGIN ATOM +M V30 1 C 2.2158 0.0324 -0.0218 0 +M V30 2 C 0.7287 0.0297 -0.0118 0 +M V30 3 C 0.0383 -1.1614 0.0667 0 +M V30 4 C -1.3527 -1.1977 0.0782 0 +M V30 5 C -2.0901 -0.0334 0.0108 0 +M V30 6 C -1.3920 1.1548 -0.0676 0 +M V30 7 C -0.0036 1.1972 -0.0794 0 +M V30 8 H 2.6349 -0.0844 1.0025 0 +M V30 9 H 2.5646 -0.8265 -0.6062 0 +M V30 10 H 2.5418 1.0131 -0.3925 0 +M V30 11 H 0.6086 -2.1021 0.1214 0 +M V30 12 H -1.8853 -2.1304 0.1396 0 +M V30 13 H -3.1787 -0.0848 0.0212 0 +M V30 14 H -1.9686 2.0588 -0.1199 0 +M V30 15 H 0.5383 2.1347 -0.1412 0 +M V30 END ATOM +M V30 BEGIN BOND +M V30 1 1 1 2 +M V30 2 2 2 3 +M V30 3 1 3 4 +M V30 4 2 4 5 +M V30 5 1 5 6 +M V30 6 2 6 7 +M V30 7 1 7 2 +M V30 8 1 1 8 +M V30 9 1 1 9 +M V30 10 1 1 10 +M V30 11 1 3 11 +M V30 12 1 4 12 +M V30 13 1 5 13 +M V30 14 1 6 14 +M V30 15 1 7 15 +M V30 END BOND +M V30 END CTAB +M END + +$$$$ From d649250a42b1befb03ff9d18e53f6dc10a33164a Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Tue, 24 Sep 2024 23:25:57 +0200 Subject: [PATCH 14/35] Shift handling to stk functions. --- python/chemiscope/input.py | 3 +-- python/chemiscope/structures/__init__.py | 13 +++++++------ python/chemiscope/structures/_stk.py | 17 +++++++++++++++-- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/python/chemiscope/input.py b/python/chemiscope/input.py index 4c9490b7a..3ac232d45 100644 --- a/python/chemiscope/input.py +++ b/python/chemiscope/input.py @@ -380,8 +380,7 @@ def create_input( # Check to tell the user they might have forgotten some properties coming # from the frames (that chemiscope used to automatically extract). This code # should be removed in version 0.6 of chemiscope. - # stk cannot have atom properties or structure properties, so skipping. - if frames is not None and not from_stk: + if frames is not None: found_one_from_frame = False atom_properties = _list_atom_properties(frames) diff --git a/python/chemiscope/structures/__init__.py b/python/chemiscope/structures/__init__.py index 28124eebb..9aa8c6506 100644 --- a/python/chemiscope/structures/__init__.py +++ b/python/chemiscope/structures/__init__.py @@ -26,6 +26,8 @@ convert_stk_bonds_as_shapes, _stk_all_atomic_environments, _stk_composition_properties, + _stk_list_atom_properties, + _stk_list_structure_properties, ) __all__ = [ @@ -83,9 +85,9 @@ def _list_atom_properties(frames): if adapter == "ASE": return _ase_list_atom_properties(frames) elif adapter == "stk": - # Do not check, because stk does not contain its own properties - # and a dictionary must be added. - pass + # stk does not contain properties inside the structure objects. + return _stk_list_atom_properties(frames) + else: raise Exception("reached unreachable code") @@ -101,9 +103,8 @@ def _list_structure_properties(frames): if adapter == "ASE": return _ase_list_structure_properties(frames) elif adapter == "stk": - # Do not check, because stk does not contain its own properties - # and a dictionary must be added. - pass + # stk does not contain properties inside the structure objects. + return _stk_list_structure_properties(frames) else: raise Exception("reached unreachable code") diff --git a/python/chemiscope/structures/_stk.py b/python/chemiscope/structures/_stk.py index 6c6d6b80e..4ffb34b60 100644 --- a/python/chemiscope/structures/_stk.py +++ b/python/chemiscope/structures/_stk.py @@ -41,8 +41,11 @@ def _stk_to_json(molecule: stk.Molecule) -> dict[str : int | list]: return data -def _stk_all_atomic_environments(frames, cutoff): - "Extract all atomic environments out of a set of ASE Atoms objects" +def _stk_all_atomic_environments( + frames: list[stk.Molecule], + cutoff: float, +) -> list[tuple[int, int, float]]: + "Extract all atomic environments out of a set of stk Molecule objects" environments = [] for structure_i, frame in enumerate(frames): for atom in frame.get_atoms(): @@ -196,3 +199,13 @@ def convert_stk_bonds_as_shapes( shape_dict[bname]["parameters"]["structure"].append(fake_bond) return shape_dict + + +def _stk_list_atom_properties(frames: list[stk.Molecule]) -> list: + # stk cannot have atom properties or structure properties, so skipping. + return [] + + +def _stk_list_structure_properties(frames: list[stk.Molecule]) -> list: + # stk cannot have atom properties or structure properties, so skipping. + return [] From af545bb6e39751c652cd9cfbbc91334b10562634 Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Tue, 24 Sep 2024 23:26:47 +0200 Subject: [PATCH 15/35] Fix lint. --- python/chemiscope/input.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/python/chemiscope/input.py b/python/chemiscope/input.py index 3ac232d45..6ef495ef4 100644 --- a/python/chemiscope/input.py +++ b/python/chemiscope/input.py @@ -11,7 +11,6 @@ import numpy as np from .structures import ( - _guess_adapter, _list_atom_properties, _list_structure_properties, frames_to_json, @@ -284,8 +283,7 @@ def create_input( data["structures"] = frames_to_json(frames) n_structures = len(data["structures"]) n_atoms = sum(s["size"] for s in data["structures"]) - _, adapter = _guess_adapter(frames) - from_stk = True if adapter == "stk" else False + else: n_atoms = 0 From be13c12f187b6f131911317de8ecb755fda0f784 Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Tue, 24 Sep 2024 23:26:58 +0200 Subject: [PATCH 16/35] Add more detail. --- python/examples/8-showing_custom_bonds.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/python/examples/8-showing_custom_bonds.py b/python/examples/8-showing_custom_bonds.py index c806d9e7a..6ef6f58f4 100644 --- a/python/examples/8-showing_custom_bonds.py +++ b/python/examples/8-showing_custom_bonds.py @@ -5,9 +5,13 @@ This example demonstrates how to add shapes into the chemiscope output such that custom bonds that would not normally be assigned by ASE can be rendered. -This is done by using stk to generate and analyse molecules, which comes with -topology/bonding information by default (using the cheminformatic software -rdkit). +This is done by using `stk `_ to +generate and analyse molecules, which comes with topology/bonding information +by default (using the cheminformatic software rdkit). + +We use `stko `_ to calculate +some rudimentary properties of `stk` molecules. `stko` can be installed with +``pip install stko``. """ From db8f7bb0acad08999b5d87233c730f68c8304102 Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Wed, 25 Sep 2024 15:25:56 +0200 Subject: [PATCH 17/35] Update requirements. --- docs/requirements.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/requirements.txt b/docs/requirements.txt index 8d5e7895e..1377149f5 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -8,6 +8,8 @@ numpy ipywidgets matplotlib ase==3.22.1 +rdkit==2024.3.4 +stk # required for the examples of chemiscope.explore mace-torch From 5222fa03acee1bd3fba39c993e888826ef97351c Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Wed, 25 Sep 2024 15:26:13 +0200 Subject: [PATCH 18/35] Change typing to work with Python 3.9. --- python/chemiscope/structures/_stk.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/chemiscope/structures/_stk.py b/python/chemiscope/structures/_stk.py index 4ffb34b60..9f2aab13b 100644 --- a/python/chemiscope/structures/_stk.py +++ b/python/chemiscope/structures/_stk.py @@ -1,3 +1,4 @@ +import typing from collections import Counter try: @@ -9,7 +10,7 @@ def _stk_valid_structures( - frames: stk.Molecule | list[stk.Molecule], + frames: typing.Union(stk.Molecule, list[stk.Molecule]), ) -> tuple[list[stk.Molecule], bool]: if HAVE_STK and isinstance(frames, stk.Molecule): # deal with the user passing a single frame From 3c86f2fa473a2d2a6c28c71172f018fd1430aad9 Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Wed, 25 Sep 2024 15:27:03 +0200 Subject: [PATCH 19/35] Bug fix. --- python/chemiscope/structures/_stk.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/chemiscope/structures/_stk.py b/python/chemiscope/structures/_stk.py index 9f2aab13b..c01a566c7 100644 --- a/python/chemiscope/structures/_stk.py +++ b/python/chemiscope/structures/_stk.py @@ -10,7 +10,7 @@ def _stk_valid_structures( - frames: typing.Union(stk.Molecule, list[stk.Molecule]), + frames: typing.Union[stk.Molecule, list[stk.Molecule]], ) -> tuple[list[stk.Molecule], bool]: if HAVE_STK and isinstance(frames, stk.Molecule): # deal with the user passing a single frame From 9dd4f45955e52aec2d636d8bcdc5de6358b91c4b Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Wed, 25 Sep 2024 15:40:36 +0200 Subject: [PATCH 20/35] Add stko dependancy for docs, remove use of __file__ for doc tests. --- docs/requirements.txt | 1 + python/examples/8-showing_custom_bonds.py | 9 +-------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index 1377149f5..741eef5a1 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -10,6 +10,7 @@ matplotlib ase==3.22.1 rdkit==2024.3.4 stk +stko # required for the examples of chemiscope.explore mace-torch diff --git a/python/examples/8-showing_custom_bonds.py b/python/examples/8-showing_custom_bonds.py index 6ef6f58f4..5afba39cd 100644 --- a/python/examples/8-showing_custom_bonds.py +++ b/python/examples/8-showing_custom_bonds.py @@ -15,16 +15,12 @@ """ -import pathlib - import stk import stko from rdkit.Chem import AllChem as rdkit import chemiscope -working_path = pathlib.Path(__file__).resolve().parent -data_path = working_path / "data" # %% # @@ -131,7 +127,7 @@ # Write to file for sanity checks. for i, struct in enumerate(structures): - struct.write(data_path / f"stk_{i}.mol") + struct.write(f"data/stk_{i}.mol") # %% # @@ -215,6 +211,3 @@ ), shapes=shape_dict, ) - - -raise SystemExit From 93ee3ed74dc8d6f8e6047a791e9adf9c8cb768b3 Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Wed, 25 Sep 2024 15:59:04 +0200 Subject: [PATCH 21/35] Handle Python 3.9 typing. --- python/chemiscope/structures/_stk.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/chemiscope/structures/_stk.py b/python/chemiscope/structures/_stk.py index c01a566c7..b2459d1b0 100644 --- a/python/chemiscope/structures/_stk.py +++ b/python/chemiscope/structures/_stk.py @@ -23,7 +23,7 @@ def _stk_valid_structures( return frames, False -def _stk_to_json(molecule: stk.Molecule) -> dict[str : int | list]: +def _stk_to_json(molecule: stk.Molecule) -> dict[str : typing.Union[int, list]]: """Implementation of frame_to_json for stk.Molcule. The current implementation assumes no periodic information, which is safe From 7eeb7989d172e15515346fce62335fb6826e62d2 Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Wed, 25 Sep 2024 15:59:42 +0200 Subject: [PATCH 22/35] Minor. --- python/examples/8-showing_custom_bonds.py | 1 - 1 file changed, 1 deletion(-) diff --git a/python/examples/8-showing_custom_bonds.py b/python/examples/8-showing_custom_bonds.py index 5afba39cd..24e9a3de6 100644 --- a/python/examples/8-showing_custom_bonds.py +++ b/python/examples/8-showing_custom_bonds.py @@ -21,7 +21,6 @@ import chemiscope - # %% # # Generate a list of stk BuildingBlocks (representation of a molecule) with From 3e72ec1647251e873802e37f38e3750b5b3be580 Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Wed, 25 Sep 2024 16:50:15 +0200 Subject: [PATCH 23/35] Provide stricter requirements for rdkit and stko. --- docs/requirements.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index 741eef5a1..6ff7f3c45 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -8,9 +8,9 @@ numpy ipywidgets matplotlib ase==3.22.1 -rdkit==2024.3.4 -stk -stko +rdkit==2023.9.5 +stk==2024.9.23.1 +stko==v2024.8.29.1 # required for the examples of chemiscope.explore mace-torch From a32eedc22f01ba74f3f20a2a7f4e303e06e66f0b Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Thu, 26 Sep 2024 11:48:37 +0200 Subject: [PATCH 24/35] For tests, use Python 3.10 stk,stko. --- docs/requirements.txt | 6 +++--- python/examples/8-showing_custom_bonds.py | 14 ++++++++------ python/examples/data/stk_3.mol | 4 ++-- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index 6ff7f3c45..61167e156 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -8,9 +8,9 @@ numpy ipywidgets matplotlib ase==3.22.1 -rdkit==2023.9.5 -stk==2024.9.23.1 -stko==v2024.8.29.1 +rdkit==2023.9.4 +stk==2022.6.17.0 +stko==0.0.40 # required for the examples of chemiscope.explore mace-torch diff --git a/python/examples/8-showing_custom_bonds.py b/python/examples/8-showing_custom_bonds.py index 24e9a3de6..3cfa5d62a 100644 --- a/python/examples/8-showing_custom_bonds.py +++ b/python/examples/8-showing_custom_bonds.py @@ -134,10 +134,12 @@ # https://stko-docs.readthedocs.io/en/latest/ energy = stko.UFFEnergy() -analyser = stko.molecule_analysis.GeometryAnalyser() +shape_calc = stko.ShapeCalculator() properties = { - "e": [energy.get_energy(molecule) for molecule in structures], - "rg": [analyser.get_radius_gyration(molecule) for molecule in structures], + "uffenergy": [energy.get_energy(molecule) for molecule in structures], + "aspheriticty": [ + shape_calc.get_results(molecule).get_asphericity() for molecule in structures + ], } @@ -175,7 +177,7 @@ frames=structures, properties=properties, meta=dict(name="Missing bonds by automation."), - settings=chemiscope.quick_settings(x="rg", y="e", color=""), + settings=chemiscope.quick_settings(x="aspheriticty", y="uffenergy", color=""), ) @@ -198,8 +200,8 @@ properties=properties, meta=dict(name="Added all stk bonds."), settings=chemiscope.quick_settings( - x="rg", - y="e", + x="aspheriticty", + y="uffenergy", color="", structure_settings={ "shape": shape_string, diff --git a/python/examples/data/stk_3.mol b/python/examples/data/stk_3.mol index e6f366ee0..babf6d638 100644 --- a/python/examples/data/stk_3.mol +++ b/python/examples/data/stk_3.mol @@ -173,8 +173,8 @@ M V30 165 H 5.7344 4.0818 -6.8141 0 M V30 166 H 7.2407 5.2573 -4.4052 0 M V30 167 H 5.6374 5.9354 -4.8815 0 M V30 168 H 6.0976 3.7143 -3.1964 0 -M V30 169 Br 1.1870 0.0000 0.0000 0 -M V30 170 Br -1.1870 0.0000 0.0000 0 +M V30 169 Br 2.1870 0.0000 0.0000 0 +M V30 170 Br -0.1870 0.0000 0.0000 0 M V30 END ATOM M V30 BEGIN BOND M V30 1 1 1 2 From 4f0ad7afebe2af33790a12c67e4de38b5c090099 Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Thu, 26 Sep 2024 14:10:16 +0200 Subject: [PATCH 25/35] WIP: Move docs to python 3.11. --- .github/workflows/website.yml | 2 +- docs/requirements.txt | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index d1c8c008b..7f9f6023b 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -21,7 +21,7 @@ jobs: cache: 'npm' - uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: '3.11' - name: configure access to git repositories in package-lock.json run: git config --global url."https://github.com/".insteadOf ssh://git@github.com - name: install npm dependencies diff --git a/docs/requirements.txt b/docs/requirements.txt index 61167e156..55e755647 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -8,9 +8,9 @@ numpy ipywidgets matplotlib ase==3.22.1 -rdkit==2023.9.4 -stk==2022.6.17.0 -stko==0.0.40 +rdkit==2023.9.5 +stk==2024.9.23.1 +stko==2024.8.29.1 # required for the examples of chemiscope.explore mace-torch From 6761b5f05bf817ff2c912636dc7762a6f087cff9 Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Fri, 27 Sep 2024 13:41:12 +0200 Subject: [PATCH 26/35] Rename file with new number. --- .../{8-showing_custom_bonds.py => 9-showing_custom_bonds.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename python/examples/{8-showing_custom_bonds.py => 9-showing_custom_bonds.py} (100%) diff --git a/python/examples/8-showing_custom_bonds.py b/python/examples/9-showing_custom_bonds.py similarity index 100% rename from python/examples/8-showing_custom_bonds.py rename to python/examples/9-showing_custom_bonds.py From f16914bbede8e26de4ddcab3bc25a431d48aa9f3 Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Fri, 27 Sep 2024 13:45:54 +0200 Subject: [PATCH 27/35] Back to Python 3.11. --- python/examples/data/stk_3.mol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/examples/data/stk_3.mol b/python/examples/data/stk_3.mol index babf6d638..e6f366ee0 100644 --- a/python/examples/data/stk_3.mol +++ b/python/examples/data/stk_3.mol @@ -173,8 +173,8 @@ M V30 165 H 5.7344 4.0818 -6.8141 0 M V30 166 H 7.2407 5.2573 -4.4052 0 M V30 167 H 5.6374 5.9354 -4.8815 0 M V30 168 H 6.0976 3.7143 -3.1964 0 -M V30 169 Br 2.1870 0.0000 0.0000 0 -M V30 170 Br -0.1870 0.0000 0.0000 0 +M V30 169 Br 1.1870 0.0000 0.0000 0 +M V30 170 Br -1.1870 0.0000 0.0000 0 M V30 END ATOM M V30 BEGIN BOND M V30 1 1 1 2 From f132c4a341aac4fc4e622eb39da7b95ff676890c Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Fri, 27 Sep 2024 13:52:33 +0200 Subject: [PATCH 28/35] Add to autofunction. --- docs/src/python/reference.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/src/python/reference.rst b/docs/src/python/reference.rst index a65851ea3..63b6af907 100644 --- a/docs/src/python/reference.rst +++ b/docs/src/python/reference.rst @@ -28,3 +28,5 @@ .. autofunction:: chemiscope.explore .. autofunction:: chemiscope.metatensor_featurizer + +.. autofunction:: chemiscope.convert_stk_bonds_as_shapes From 5694ede281f276c3a957d0b910c751c053f2ad16 Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Fri, 27 Sep 2024 13:57:03 +0200 Subject: [PATCH 29/35] Update example comments. --- python/examples/9-showing_custom_bonds.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/python/examples/9-showing_custom_bonds.py b/python/examples/9-showing_custom_bonds.py index 3cfa5d62a..d5c1beb35 100644 --- a/python/examples/9-showing_custom_bonds.py +++ b/python/examples/9-showing_custom_bonds.py @@ -158,19 +158,14 @@ # %% # -# A chemiscope widget can be used to visualize structures and properties. -# This generates a Chemiscope object that is rendered to an interactive -# widget when executed in a Jupyter notebook. +# A chemiscope widget showing the result without the added bonding. chemiscope.show(frames=structures, properties=properties) # %% # -# For sharing with collaborators, or when one does not want to use an interactive -# notebook, one can also write a JSON (or compressed JSON) file that contains all -# information about structures and properties, and can be viewed at chemiscope.org -# Save as a file that can be viewed at chemiscope.org +# Writing to a json.gz file, again without added bonding. chemiscope.write_input( path="noshape_example.json.gz", @@ -193,7 +188,8 @@ # %% # -# Write to json file with added shapes and note are present. +# Write to json file with added shapes. + chemiscope.write_input( path="shape_example.json.gz", frames=structures, From 59b19668342802e6ca391fbc82d09a7dfe5e67fc Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Thu, 3 Oct 2024 17:01:56 +0200 Subject: [PATCH 30/35] Add comment about pins. --- docs/requirements.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/requirements.txt b/docs/requirements.txt index 55e755647..3a43f19d4 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -8,6 +8,9 @@ numpy ipywidgets matplotlib ase==3.22.1 +# These three pins are to avoid rdkit version 2024.3.5. Once a later version +# is available, the latest version (assuming Python >= 3.11) of all three +# should be ok. rdkit==2023.9.5 stk==2024.9.23.1 stko==2024.8.29.1 From c9191b68fff9312d12b30c2dc6c7f76005330777 Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Thu, 3 Oct 2024 17:04:09 +0200 Subject: [PATCH 31/35] Update README. --- python/README.md | 36 ++++-------------------------------- 1 file changed, 4 insertions(+), 32 deletions(-) diff --git a/python/README.md b/python/README.md index ddd6ae200..acc9b97fd 100644 --- a/python/README.md +++ b/python/README.md @@ -24,6 +24,8 @@ import chemiscope import ase.io # read frames using ase +# frames can also be stk objets, e.g. +# frames = [stk.BuildingBlock(smiles="NCCN")] frames = ase.io.read("structures.xyz", ":") # add additional properties to display @@ -44,6 +46,8 @@ import chemiscope import ase.io # read frames using ase +# frames can also be stk objets, e.g. +# frames = [stk.BuildingBlock(smiles="NCCN")] frames = ase.io.read("structures.xyz", ":") # add additional properties to display @@ -53,35 +57,3 @@ properties = { chemiscope.show(frames=frames, properties=properties) ``` - -To create a new chemiscope input file using `stk`_: - -.. _`stk`: https://github.com/lukasturcani/stk - -`stk` is an optional dependancy: - -```bash -pip install stk -``` - -```python -import chemiscope -import stk - -# read frames using ase -frames = [stk.BuildingBlock(smiles="NCCN")] - -# add additional properties to display -properties = { - "": { - target: "atom", - values: [3, 4, 2, 8, 9, 10], - } -} - -chemiscope.write_input( - "my-input.json.gz", - frames=frames, - properties=properties, -) -``` \ No newline at end of file From 4fa814d98046ca555b44c50ad70c3cbc3deda4e2 Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Thu, 3 Oct 2024 17:10:23 +0200 Subject: [PATCH 32/35] Clean up import. --- python/chemiscope/structures/__init__.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/python/chemiscope/structures/__init__.py b/python/chemiscope/structures/__init__.py index 9aa8c6506..7141b3404 100644 --- a/python/chemiscope/structures/__init__.py +++ b/python/chemiscope/structures/__init__.py @@ -20,7 +20,7 @@ ase_tensors_to_ellipsoids, ase_vectors_to_arrows, ) -from ._stk import ( +from ._stk import ( # noqa: F401 _stk_valid_structures, _stk_to_json, convert_stk_bonds_as_shapes, @@ -30,10 +30,6 @@ _stk_list_structure_properties, ) -__all__ = [ - "convert_stk_bonds_as_shapes", -] - def _guess_adapter(frames): """ From 850b2ca45d874e682d15823f79f317a9d21e677e Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Thu, 3 Oct 2024 17:17:34 +0200 Subject: [PATCH 33/35] Update example. --- python/examples/9-showing_custom_bonds.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/examples/9-showing_custom_bonds.py b/python/examples/9-showing_custom_bonds.py index d5c1beb35..fab081951 100644 --- a/python/examples/9-showing_custom_bonds.py +++ b/python/examples/9-showing_custom_bonds.py @@ -3,7 +3,7 @@ ============================== This example demonstrates how to add shapes into the chemiscope output such -that custom bonds that would not normally be assigned by ASE can be rendered. +that custom bonds that would not automatically be assigned can be rendered. This is done by using `stk `_ to generate and analyse molecules, which comes with topology/bonding information From 995f6acacbdd563469ff8a38af92bf77ad82bbb8 Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Thu, 3 Oct 2024 17:17:49 +0200 Subject: [PATCH 34/35] Move type check. --- python/chemiscope/structures/__init__.py | 19 ++++++------------- python/chemiscope/structures/_ase.py | 6 +++++- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/python/chemiscope/structures/__init__.py b/python/chemiscope/structures/__init__.py index 7141b3404..059e05b45 100644 --- a/python/chemiscope/structures/__init__.py +++ b/python/chemiscope/structures/__init__.py @@ -37,13 +37,10 @@ def _guess_adapter(frames): frames as a list and a string describing which adapter should be used. """ - try: - ase_frames, use_ase = _ase_valid_structures(frames) - if use_ase: - return ase_frames, "ASE" - except TypeError: - # Error associated with it being an stk list. - pass + ase_frames, use_ase = _ase_valid_structures(frames) + if use_ase: + return ase_frames, "ASE" + stk_frames, use_stk = _stk_valid_structures(frames) if use_stk: return stk_frames, "stk" @@ -81,7 +78,6 @@ def _list_atom_properties(frames): if adapter == "ASE": return _ase_list_atom_properties(frames) elif adapter == "stk": - # stk does not contain properties inside the structure objects. return _stk_list_atom_properties(frames) else: @@ -99,7 +95,6 @@ def _list_structure_properties(frames): if adapter == "ASE": return _ase_list_structure_properties(frames) elif adapter == "stk": - # stk does not contain properties inside the structure objects. return _stk_list_structure_properties(frames) else: raise Exception("reached unreachable code") @@ -123,11 +118,9 @@ def extract_properties(frames, only=None, environments=None): return _ase_extract_properties(frames, only, environments) elif adapter == "stk": - msg = ( - "stk molecules do not contain properties, you must write your " - "own dictionary as in example 8." + raise RuntimeError( + "stk molecules do not contain properties, you must manually provide them" ) - raise RuntimeError(msg) else: raise Exception("reached unreachable code") diff --git a/python/chemiscope/structures/_ase.py b/python/chemiscope/structures/_ase.py index c597624b4..f10538e1f 100644 --- a/python/chemiscope/structures/_ase.py +++ b/python/chemiscope/structures/_ase.py @@ -15,7 +15,11 @@ def _ase_valid_structures(frames): - frames_list = list(frames) + try: + frames_list = list(frames) + except TypeError: + return [], False + if HAVE_ASE and isinstance(frames_list[0], ase.Atoms): for frame in frames_list: assert isinstance(frame, ase.Atoms) From 859351f3b5e6816fa18f65a14191d4e55b261162 Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Thu, 3 Oct 2024 17:19:06 +0200 Subject: [PATCH 35/35] Remove unnecessary files. --- python/examples/9-showing_custom_bonds.py | 3 - python/examples/data/stk_0.mol | 37 --- python/examples/data/stk_1.mol | 176 ----------- python/examples/data/stk_2.mol | 272 ---------------- python/examples/data/stk_3.mol | 365 ---------------------- python/examples/data/stk_4.mol | 44 --- 6 files changed, 897 deletions(-) delete mode 100644 python/examples/data/stk_0.mol delete mode 100644 python/examples/data/stk_1.mol delete mode 100644 python/examples/data/stk_2.mol delete mode 100644 python/examples/data/stk_3.mol delete mode 100644 python/examples/data/stk_4.mol diff --git a/python/examples/9-showing_custom_bonds.py b/python/examples/9-showing_custom_bonds.py index fab081951..9c5af3658 100644 --- a/python/examples/9-showing_custom_bonds.py +++ b/python/examples/9-showing_custom_bonds.py @@ -124,9 +124,6 @@ stk.BuildingBlock.init_from_rdkit_mol(rdkitmol), ] -# Write to file for sanity checks. -for i, struct in enumerate(structures): - struct.write(f"data/stk_{i}.mol") # %% # diff --git a/python/examples/data/stk_0.mol b/python/examples/data/stk_0.mol deleted file mode 100644 index cd294ed00..000000000 --- a/python/examples/data/stk_0.mol +++ /dev/null @@ -1,37 +0,0 @@ - - RDKit 3D - - 0 0 0 0 0 0 0 0 0 0999 V3000 -M V30 BEGIN CTAB -M V30 COUNTS 12 11 0 0 0 -M V30 BEGIN ATOM -M V30 1 N -1.3789 -0.7953 0.3238 0 -M V30 2 C -0.6980 0.4411 0.5929 0 -M V30 3 C 0.4802 0.6365 -0.3568 0 -M V30 4 N 1.4531 -0.3716 -0.2778 0 -M V30 5 H -1.8591 -0.7562 -0.6012 0 -M V30 6 H -0.7320 -1.6254 0.3496 0 -M V30 7 H -0.3501 0.4675 1.6463 0 -M V30 8 H -1.4140 1.2621 0.3731 0 -M V30 9 H 0.0242 0.6054 -1.3880 0 -M V30 10 H 0.9168 1.6345 -0.1926 0 -M V30 11 H 1.4680 -1.1058 -0.9708 0 -M V30 12 H 2.0898 -0.3929 0.5016 0 -M V30 END ATOM -M V30 BEGIN BOND -M V30 1 1 1 2 -M V30 2 1 2 3 -M V30 3 1 3 4 -M V30 4 1 1 5 -M V30 5 1 1 6 -M V30 6 1 2 7 -M V30 7 1 2 8 -M V30 8 1 3 9 -M V30 9 1 3 10 -M V30 10 1 4 11 -M V30 11 1 4 12 -M V30 END BOND -M V30 END CTAB -M END - -$$$$ diff --git a/python/examples/data/stk_1.mol b/python/examples/data/stk_1.mol deleted file mode 100644 index 9b327414e..000000000 --- a/python/examples/data/stk_1.mol +++ /dev/null @@ -1,176 +0,0 @@ - - RDKit 3D - - 0 0 0 0 0 0 0 0 0 0999 V3000 -M V30 BEGIN CTAB -M V30 COUNTS 80 82 0 0 0 -M V30 BEGIN ATOM -M V30 1 C -1.2556 -0.4225 4.0772 0 -M V30 2 C -0.0397 0.2975 4.5383 0 -M V30 3 C 1.1868 -0.4347 4.0772 0 -M V30 4 C -0.0576 1.6914 4.0772 0 -M V30 5 H -1.4528 -0.5880 3.0318 0 -M V30 6 H -0.0193 0.3109 5.6490 0 -M V30 7 H 1.3357 -0.5727 3.0009 0 -M V30 8 H 0.7275 2.4052 4.2944 0 -M V30 9 C -3.7498 -1.7805 0.1839 0 -M V30 10 C -3.7106 -1.7760 -1.3020 0 -M V30 11 C -3.7569 -0.3623 -1.8045 0 -M V30 12 C -2.5293 -2.4982 -1.7907 0 -M V30 13 H -2.9918 -1.2913 0.7714 0 -M V30 14 H -4.6098 -2.2967 -1.6952 0 -M V30 15 H -2.9577 0.3230 -1.5023 0 -M V30 16 H -2.2946 -2.6232 -2.8406 0 -M V30 17 C 3.6233 -2.0364 -0.2630 0 -M V30 18 C 3.5997 -2.0048 -1.7488 0 -M V30 19 C 2.3985 -2.7516 -2.2514 0 -M V30 20 C 3.6345 -0.6206 -2.2376 0 -M V30 21 H 2.8205 -1.6246 0.3245 0 -M V30 22 H 4.5003 -2.5231 -2.1420 0 -M V30 23 H 1.4054 -2.4023 -1.9492 0 -M V30 24 H 3.6254 -0.3549 -3.2875 0 -M V30 25 C -0.1654 5.0154 -0.1294 0 -M V30 26 C -0.1810 4.9791 -1.6153 0 -M V30 27 C 1.0664 4.3124 -2.1178 0 -M V30 28 C -1.3971 4.3173 -2.1040 0 -M V30 29 H -0.1207 4.1143 0.4581 0 -M V30 30 H -0.1824 6.0182 -2.0084 0 -M V30 31 H 1.2603 3.2776 -1.8156 0 -M V30 32 H -1.6227 4.1765 -3.1539 0 -M V30 33 N -2.4870 -1.4284 4.1027 0 -M V30 34 C -3.8743 -1.8020 4.1257 0 -M V30 35 C -4.1982 -2.7786 2.9988 0 -M V30 36 N -3.9500 -2.2731 1.7136 0 -M V30 37 H -4.5169 -0.9007 4.0487 0 -M V30 38 H -4.0476 -2.3537 5.0747 0 -M V30 39 H -3.5080 -3.6538 3.1720 0 -M V30 40 H -5.2394 -3.1223 3.1048 0 -M V30 41 N 2.4914 -1.4606 3.6815 0 -M V30 42 C 3.5084 -2.4755 3.7045 0 -M V30 43 C 4.5162 -2.2677 2.5777 0 -M V30 44 N 3.9544 -2.3053 1.2924 0 -M V30 45 H 3.0489 -3.4825 3.6273 0 -M V30 46 H 4.0728 -2.3500 4.6535 0 -M V30 47 H 4.9293 -1.2325 2.7510 0 -M V30 48 H 5.3343 -2.9978 2.6836 0 -M V30 49 N -0.0432 3.5590 3.9060 0 -M V30 50 C 0.3254 4.9476 3.9293 0 -M V30 51 C -0.3584 5.7156 2.8019 0 -M V30 52 N -0.0432 5.2483 1.5169 0 -M V30 53 H 1.4272 5.0547 3.8532 0 -M V30 54 H -0.0670 5.3731 4.8780 0 -M V30 55 H -1.4614 5.5543 2.9742 0 -M V30 56 H -0.1367 6.7895 2.9081 0 -M V30 57 N -1.5947 -3.7958 -2.6583 0 -M V30 58 C -0.8120 -4.5200 -3.6214 0 -M V30 59 C 0.5519 -4.8952 -3.0492 0 -M V30 60 N 1.3313 -3.7958 -2.6583 0 -M V30 61 H -0.6881 -3.9197 -4.5463 0 -M V30 62 H -1.3409 -5.4775 -3.8176 0 -M V30 63 H 0.3181 -5.5054 -2.1299 0 -M V30 64 H 1.0853 -5.5334 -3.7717 0 -M V30 65 N -4.0129 0.8090 -2.7690 0 -M V30 66 C -4.6181 2.0621 -3.1270 0 -M V30 67 C -3.5788 3.0371 -3.6728 0 -M V30 68 N -2.5499 3.3430 -2.7690 0 -M V30 69 H -5.1355 2.5040 -2.2505 0 -M V30 70 H -5.3215 1.8575 -3.9627 0 -M V30 71 H -3.1237 2.5043 -4.5568 0 -M V30 72 H -4.0872 3.9465 -4.0307 0 -M V30 73 N 3.8995 1.1677 -2.7340 0 -M V30 74 C 4.1353 2.2077 -3.6971 0 -M V30 75 C 3.7783 3.5765 -3.1249 0 -M V30 76 N 2.4365 3.7017 -2.7340 0 -M V30 77 H 3.5534 2.0149 -4.6220 0 -M V30 78 H 5.2290 2.2284 -3.8933 0 -M V30 79 H 4.4236 3.6791 -2.2055 0 -M V30 80 H 4.0643 4.3575 -3.8474 0 -M V30 END ATOM -M V30 BEGIN BOND -M V30 1 1 1 2 -M V30 2 1 2 3 -M V30 3 1 2 4 -M V30 4 1 1 5 -M V30 5 1 2 6 -M V30 6 1 3 7 -M V30 7 1 4 8 -M V30 8 1 9 10 -M V30 9 1 10 11 -M V30 10 1 10 12 -M V30 11 1 9 13 -M V30 12 1 10 14 -M V30 13 1 11 15 -M V30 14 1 12 16 -M V30 15 1 17 18 -M V30 16 1 18 19 -M V30 17 1 18 20 -M V30 18 1 17 21 -M V30 19 1 18 22 -M V30 20 1 19 23 -M V30 21 1 20 24 -M V30 22 1 25 26 -M V30 23 1 26 27 -M V30 24 1 26 28 -M V30 25 1 25 29 -M V30 26 1 26 30 -M V30 27 1 27 31 -M V30 28 1 28 32 -M V30 29 1 33 34 -M V30 30 1 34 35 -M V30 31 1 35 36 -M V30 32 1 34 37 -M V30 33 1 34 38 -M V30 34 1 35 39 -M V30 35 1 35 40 -M V30 36 1 41 42 -M V30 37 1 42 43 -M V30 38 1 43 44 -M V30 39 1 42 45 -M V30 40 1 42 46 -M V30 41 1 43 47 -M V30 42 1 43 48 -M V30 43 1 49 50 -M V30 44 1 50 51 -M V30 45 1 51 52 -M V30 46 1 50 53 -M V30 47 1 50 54 -M V30 48 1 51 55 -M V30 49 1 51 56 -M V30 50 1 57 58 -M V30 51 1 58 59 -M V30 52 1 59 60 -M V30 53 1 58 61 -M V30 54 1 58 62 -M V30 55 1 59 63 -M V30 56 1 59 64 -M V30 57 1 65 66 -M V30 58 1 66 67 -M V30 59 1 67 68 -M V30 60 1 66 69 -M V30 61 1 66 70 -M V30 62 1 67 71 -M V30 63 1 67 72 -M V30 64 1 73 74 -M V30 65 1 74 75 -M V30 66 1 75 76 -M V30 67 1 74 77 -M V30 68 1 74 78 -M V30 69 1 75 79 -M V30 70 1 75 80 -M V30 71 2 1 33 -M V30 72 2 9 36 -M V30 73 2 3 41 -M V30 74 2 17 44 -M V30 75 2 4 49 -M V30 76 2 25 52 -M V30 77 2 12 57 -M V30 78 2 19 60 -M V30 79 2 11 65 -M V30 80 2 28 68 -M V30 81 2 20 73 -M V30 82 2 27 76 -M V30 END BOND -M V30 END CTAB -M END - -$$$$ diff --git a/python/examples/data/stk_2.mol b/python/examples/data/stk_2.mol deleted file mode 100644 index f0dfe7c02..000000000 --- a/python/examples/data/stk_2.mol +++ /dev/null @@ -1,272 +0,0 @@ - - RDKit 3D - - 0 0 0 0 0 0 0 0 0 0999 V3000 -M V30 BEGIN CTAB -M V30 COUNTS 122 136 0 0 0 -M V30 BEGIN ATOM -M V30 1 Pd 0.0000 6.7061 0.0000 0 CHG=2 -M V30 2 Pd 0.0000 -6.7061 0.0000 0 CHG=2 -M V30 3 C 14.6172 4.7881 -0.6066 0 -M V30 4 N 13.4123 4.8933 -0.0000 0 -M V30 5 C 12.9018 3.7993 0.5932 0 -M V30 6 C 13.5659 2.5874 0.5996 0 -M V30 7 C 14.7939 2.4749 -0.0171 0 -M V30 8 C 15.4939 1.1926 -0.0090 0 -M V30 9 C 16.8711 1.1292 -0.0077 0 -M V30 10 C 17.5565 -0.0840 0.0004 0 -M V30 11 C 16.8578 -1.2740 0.0075 0 -M V30 12 C 15.4780 -1.2425 0.0064 0 -M V30 13 C 14.7497 -2.4936 0.0146 0 -M V30 14 C 13.5220 -2.5919 0.6235 0 -M V30 15 C 12.8806 -3.8096 0.5967 0 -M V30 16 N 13.4123 -4.8933 0.0000 0 -M V30 17 C 14.6118 -4.8155 -0.6003 0 -M V30 18 C 15.2647 -3.6219 -0.5866 0 -M V30 19 C 14.8141 -0.0144 -0.0018 0 -M V30 20 C 15.3148 3.5984 -0.6246 0 -M V30 21 H 14.9944 5.6977 -1.0750 0 -M V30 22 H 11.9249 3.8319 1.1009 0 -M V30 23 H 13.1630 1.6997 1.0741 0 -M V30 24 H 17.4342 2.0590 -0.0132 0 -M V30 25 H 18.6349 -0.1061 0.0012 0 -M V30 26 H 17.3723 -2.2363 0.0139 0 -M V30 27 H 13.0431 -1.7455 1.1225 0 -M V30 28 H 11.9020 -3.9029 1.0772 0 -M V30 29 H 15.0316 -5.7081 -1.0820 0 -M V30 30 H 16.2391 -3.5986 -1.0858 0 -M V30 31 H 13.7460 0.0126 -0.0026 0 -M V30 32 H 16.2634 3.5747 -1.1195 0 -M V30 33 C 0.6066 4.7881 14.6172 0 -M V30 34 N 0.0000 4.8933 13.4123 0 -M V30 35 C -0.5932 3.7993 12.9018 0 -M V30 36 C -0.5996 2.5874 13.5659 0 -M V30 37 C 0.0171 2.4749 14.7939 0 -M V30 38 C 0.0090 1.1926 15.4939 0 -M V30 39 C 0.0077 1.1292 16.8711 0 -M V30 40 C -0.0004 -0.0840 17.5565 0 -M V30 41 C -0.0075 -1.2740 16.8578 0 -M V30 42 C -0.0064 -1.2425 15.4780 0 -M V30 43 C -0.0146 -2.4936 14.7497 0 -M V30 44 C -0.6235 -2.5919 13.5220 0 -M V30 45 C -0.5967 -3.8096 12.8806 0 -M V30 46 N 0.0000 -4.8933 13.4123 0 -M V30 47 C 0.6003 -4.8155 14.6118 0 -M V30 48 C 0.5866 -3.6219 15.2647 0 -M V30 49 C 0.0018 -0.0144 14.8141 0 -M V30 50 C 0.6246 3.5984 15.3148 0 -M V30 51 H 1.0750 5.6977 14.9944 0 -M V30 52 H -1.1009 3.8319 11.9249 0 -M V30 53 H -1.0741 1.6997 13.1630 0 -M V30 54 H 0.0132 2.0590 17.4342 0 -M V30 55 H -0.0012 -0.1061 18.6349 0 -M V30 56 H -0.0139 -2.2363 17.3723 0 -M V30 57 H -1.1225 -1.7455 13.0431 0 -M V30 58 H -1.0772 -3.9029 11.9020 0 -M V30 59 H 1.0820 -5.7081 15.0316 0 -M V30 60 H 1.0858 -3.5986 16.2391 0 -M V30 61 H 0.0026 0.0126 13.7460 0 -M V30 62 H 1.1195 3.5747 16.2634 0 -M V30 63 C -14.6172 4.7881 0.6066 0 -M V30 64 N -13.4123 4.8933 0.0000 0 -M V30 65 C -12.9018 3.7993 -0.5932 0 -M V30 66 C -13.5659 2.5874 -0.5996 0 -M V30 67 C -14.7939 2.4749 0.0171 0 -M V30 68 C -15.4939 1.1926 0.0090 0 -M V30 69 C -16.8711 1.1292 0.0077 0 -M V30 70 C -17.5565 -0.0840 -0.0004 0 -M V30 71 C -16.8578 -1.2740 -0.0075 0 -M V30 72 C -15.4780 -1.2425 -0.0064 0 -M V30 73 C -14.7497 -2.4936 -0.0146 0 -M V30 74 C -13.5220 -2.5919 -0.6235 0 -M V30 75 C -12.8806 -3.8096 -0.5967 0 -M V30 76 N -13.4123 -4.8933 -0.0000 0 -M V30 77 C -14.6118 -4.8155 0.6003 0 -M V30 78 C -15.2647 -3.6219 0.5866 0 -M V30 79 C -14.8141 -0.0144 0.0018 0 -M V30 80 C -15.3148 3.5984 0.6246 0 -M V30 81 H -14.9944 5.6977 1.0750 0 -M V30 82 H -11.9249 3.8319 -1.1009 0 -M V30 83 H -13.1630 1.6997 -1.0741 0 -M V30 84 H -17.4342 2.0590 0.0132 0 -M V30 85 H -18.6349 -0.1061 -0.0012 0 -M V30 86 H -17.3723 -2.2363 -0.0139 0 -M V30 87 H -13.0431 -1.7455 -1.1225 0 -M V30 88 H -11.9020 -3.9029 -1.0772 0 -M V30 89 H -15.0316 -5.7081 1.0820 0 -M V30 90 H -16.2391 -3.5986 1.0858 0 -M V30 91 H -13.7460 0.0126 0.0026 0 -M V30 92 H -16.2634 3.5747 1.1195 0 -M V30 93 C -0.6066 4.7881 -14.6172 0 -M V30 94 N -0.0000 4.8933 -13.4123 0 -M V30 95 C 0.5932 3.7993 -12.9018 0 -M V30 96 C 0.5996 2.5874 -13.5659 0 -M V30 97 C -0.0171 2.4749 -14.7939 0 -M V30 98 C -0.0090 1.1926 -15.4939 0 -M V30 99 C -0.0077 1.1292 -16.8711 0 -M V30 100 C 0.0004 -0.0840 -17.5565 0 -M V30 101 C 0.0075 -1.2740 -16.8578 0 -M V30 102 C 0.0064 -1.2425 -15.4780 0 -M V30 103 C 0.0146 -2.4936 -14.7497 0 -M V30 104 C 0.6235 -2.5919 -13.5220 0 -M V30 105 C 0.5967 -3.8096 -12.8806 0 -M V30 106 N -0.0000 -4.8933 -13.4123 0 -M V30 107 C -0.6003 -4.8155 -14.6118 0 -M V30 108 C -0.5866 -3.6219 -15.2647 0 -M V30 109 C -0.0018 -0.0144 -14.8141 0 -M V30 110 C -0.6246 3.5984 -15.3148 0 -M V30 111 H -1.0750 5.6977 -14.9944 0 -M V30 112 H 1.1009 3.8319 -11.9249 0 -M V30 113 H 1.0741 1.6997 -13.1630 0 -M V30 114 H -0.0132 2.0590 -17.4342 0 -M V30 115 H 0.0012 -0.1061 -18.6349 0 -M V30 116 H 0.0139 -2.2363 -17.3723 0 -M V30 117 H 1.1225 -1.7455 -13.0431 0 -M V30 118 H 1.0772 -3.9029 -11.9020 0 -M V30 119 H -1.0820 -5.7081 -15.0316 0 -M V30 120 H -1.0858 -3.5986 -16.2391 0 -M V30 121 H -0.0026 0.0126 -13.7460 0 -M V30 122 H -1.1195 3.5747 -16.2634 0 -M V30 END ATOM -M V30 BEGIN BOND -M V30 1 2 3 4 -M V30 2 1 4 5 -M V30 3 2 5 6 -M V30 4 1 6 7 -M V30 5 1 7 8 -M V30 6 2 8 9 -M V30 7 1 9 10 -M V30 8 2 10 11 -M V30 9 1 11 12 -M V30 10 1 12 13 -M V30 11 2 13 14 -M V30 12 1 14 15 -M V30 13 2 15 16 -M V30 14 1 16 17 -M V30 15 2 17 18 -M V30 16 2 12 19 -M V30 17 2 7 20 -M V30 18 1 20 3 -M V30 19 1 19 8 -M V30 20 1 18 13 -M V30 21 1 3 21 -M V30 22 1 5 22 -M V30 23 1 6 23 -M V30 24 1 9 24 -M V30 25 1 10 25 -M V30 26 1 11 26 -M V30 27 1 14 27 -M V30 28 1 15 28 -M V30 29 1 17 29 -M V30 30 1 18 30 -M V30 31 1 19 31 -M V30 32 1 20 32 -M V30 33 2 33 34 -M V30 34 1 34 35 -M V30 35 2 35 36 -M V30 36 1 36 37 -M V30 37 1 37 38 -M V30 38 2 38 39 -M V30 39 1 39 40 -M V30 40 2 40 41 -M V30 41 1 41 42 -M V30 42 1 42 43 -M V30 43 2 43 44 -M V30 44 1 44 45 -M V30 45 2 45 46 -M V30 46 1 46 47 -M V30 47 2 47 48 -M V30 48 2 42 49 -M V30 49 2 37 50 -M V30 50 1 50 33 -M V30 51 1 49 38 -M V30 52 1 48 43 -M V30 53 1 33 51 -M V30 54 1 35 52 -M V30 55 1 36 53 -M V30 56 1 39 54 -M V30 57 1 40 55 -M V30 58 1 41 56 -M V30 59 1 44 57 -M V30 60 1 45 58 -M V30 61 1 47 59 -M V30 62 1 48 60 -M V30 63 1 49 61 -M V30 64 1 50 62 -M V30 65 2 63 64 -M V30 66 1 64 65 -M V30 67 2 65 66 -M V30 68 1 66 67 -M V30 69 1 67 68 -M V30 70 2 68 69 -M V30 71 1 69 70 -M V30 72 2 70 71 -M V30 73 1 71 72 -M V30 74 1 72 73 -M V30 75 2 73 74 -M V30 76 1 74 75 -M V30 77 2 75 76 -M V30 78 1 76 77 -M V30 79 2 77 78 -M V30 80 2 72 79 -M V30 81 2 67 80 -M V30 82 1 80 63 -M V30 83 1 79 68 -M V30 84 1 78 73 -M V30 85 1 63 81 -M V30 86 1 65 82 -M V30 87 1 66 83 -M V30 88 1 69 84 -M V30 89 1 70 85 -M V30 90 1 71 86 -M V30 91 1 74 87 -M V30 92 1 75 88 -M V30 93 1 77 89 -M V30 94 1 78 90 -M V30 95 1 79 91 -M V30 96 1 80 92 -M V30 97 2 93 94 -M V30 98 1 94 95 -M V30 99 2 95 96 -M V30 100 1 96 97 -M V30 101 1 97 98 -M V30 102 2 98 99 -M V30 103 1 99 100 -M V30 104 2 100 101 -M V30 105 1 101 102 -M V30 106 1 102 103 -M V30 107 2 103 104 -M V30 108 1 104 105 -M V30 109 2 105 106 -M V30 110 1 106 107 -M V30 111 2 107 108 -M V30 112 2 102 109 -M V30 113 2 97 110 -M V30 114 1 110 93 -M V30 115 1 109 98 -M V30 116 1 108 103 -M V30 117 1 93 111 -M V30 118 1 95 112 -M V30 119 1 96 113 -M V30 120 1 99 114 -M V30 121 1 100 115 -M V30 122 1 101 116 -M V30 123 1 104 117 -M V30 124 1 105 118 -M V30 125 1 107 119 -M V30 126 1 108 120 -M V30 127 1 109 121 -M V30 128 1 110 122 -M V30 129 9 4 1 -M V30 130 9 34 1 -M V30 131 9 64 1 -M V30 132 9 94 1 -M V30 133 9 16 2 -M V30 134 9 46 2 -M V30 135 9 76 2 -M V30 136 9 106 2 -M V30 END BOND -M V30 END CTAB -M END - -$$$$ diff --git a/python/examples/data/stk_3.mol b/python/examples/data/stk_3.mol deleted file mode 100644 index e6f366ee0..000000000 --- a/python/examples/data/stk_3.mol +++ /dev/null @@ -1,365 +0,0 @@ - - RDKit 3D - - 0 0 0 0 0 0 0 0 0 0999 V3000 -M V30 BEGIN CTAB -M V30 COUNTS 170 181 0 0 0 -M V30 BEGIN ATOM -M V30 1 C -2.5393 -1.2587 5.2649 0 -M V30 2 C -1.2725 -0.5338 5.2649 0 -M V30 3 C -1.2400 0.8527 5.2649 0 -M V30 4 C -0.0713 1.5643 5.2649 0 -M V30 5 C -0.0571 3.0229 5.2649 0 -M V30 6 C 1.0968 0.8497 5.2649 0 -M V30 7 C 1.1356 -0.5436 5.2649 0 -M V30 8 C 2.4110 -1.2491 5.2649 0 -M V30 9 C -0.0685 -1.1963 5.2649 0 -M V30 10 H -2.5200 -2.3313 5.2649 0 -M V30 11 H -2.1982 1.3669 5.2649 0 -M V30 12 H 0.8725 3.5663 5.2649 0 -M V30 13 H 2.0496 1.3873 5.2649 0 -M V30 14 H 3.3080 -0.6695 5.2649 0 -M V30 15 H -0.0712 -2.2788 5.2649 0 -M V30 16 C -5.3748 -3.1335 1.1212 0 -M V30 17 C -4.9564 -2.8854 -0.2548 0 -M V30 18 C -4.1559 -3.7909 -0.9350 0 -M V30 19 C -3.7450 -3.5906 -2.2247 0 -M V30 20 C -2.9029 -4.5548 -2.9239 0 -M V30 21 C -4.1576 -2.4398 -2.8415 0 -M V30 22 C -4.9620 -1.4885 -2.2165 0 -M V30 23 C -5.3693 -0.2819 -2.9252 0 -M V30 24 C -5.3388 -1.7486 -0.9256 0 -M V30 25 H -5.9941 -2.4073 1.6110 0 -M V30 26 H -3.8590 -4.6870 -0.3950 0 -M V30 27 H -2.5892 -4.3804 -3.9390 0 -M V30 28 H -3.8472 -2.2482 -3.8729 0 -M V30 29 H -5.0347 -0.1503 -3.9308 0 -M V30 30 H -5.9638 -1.0285 -0.4132 0 -M V30 31 C 5.1527 -2.9337 0.9085 0 -M V30 32 C 4.7285 -2.6954 -0.4675 0 -M V30 33 C 5.1125 -1.5494 -1.1476 0 -M V30 34 C 4.7336 -1.2937 -2.4373 0 -M V30 35 C 5.1475 -0.0823 -3.1365 0 -M V30 36 C 3.9433 -2.2264 -3.0541 0 -M V30 37 C 3.5217 -3.3987 -2.4291 0 -M V30 38 C 2.6803 -4.3547 -3.1378 0 -M V30 39 C 3.9353 -3.5950 -1.1382 0 -M V30 40 H 4.8334 -3.8332 1.3984 0 -M V30 41 H 5.7401 -0.8442 -0.6076 0 -M V30 42 H 4.8396 0.1022 -4.1517 0 -M V30 43 H 3.6221 -2.0534 -4.0856 0 -M V30 44 H 2.3991 -4.1307 -4.1435 0 -M V30 45 H 3.6242 -4.4963 -0.6258 0 -M V30 46 C 0.2771 5.8890 0.7434 0 -M V30 47 C 0.2828 5.4025 -0.6326 0 -M V30 48 C -0.9017 5.1620 -1.3128 0 -M V30 49 C -0.9336 4.7060 -2.6025 0 -M V30 50 C -2.1897 4.4588 -3.3017 0 -M V30 51 C 0.2693 4.4879 -3.2193 0 -M V30 52 C 1.4953 4.7089 -2.5943 0 -M V30 53 C 2.7439 4.4584 -3.3030 0 -M V30 54 C 1.4585 5.1653 -1.3034 0 -M V30 55 H 1.2157 6.0622 1.2332 0 -M V30 56 H -1.8262 5.3529 -0.7728 0 -M V30 57 H -2.1955 4.0999 -4.3168 0 -M V30 58 H 0.2800 4.1233 -4.2507 0 -M V30 59 H 2.6906 4.1028 -4.3086 0 -M V30 60 H 2.3946 5.3465 -0.7910 0 -M V30 61 N -3.9995 -2.4253 5.2236 0 -M V30 62 C -5.4158 -2.8155 5.1613 0 -M V30 63 C -5.7872 -3.2781 6.5523 0 -M V30 64 C -7.0619 -4.0595 6.5945 0 -M V30 65 C -7.7087 -3.9302 5.2113 0 -M V30 66 C -6.7934 -4.7174 4.2776 0 -M V30 67 C -5.5256 -3.8946 4.1338 0 -M V30 68 N -5.4752 -3.2773 2.8138 0 -M V30 69 H -5.9636 -1.8840 4.8745 0 -M V30 70 H -4.9665 -3.9451 6.8946 0 -M V30 71 H -5.9109 -2.3910 7.1992 0 -M V30 72 H -6.8650 -5.1557 6.7160 0 -M V30 73 H -7.7332 -3.7367 7.3959 0 -M V30 74 H -8.7057 -4.3809 5.2971 0 -M V30 75 H -7.7738 -2.8742 4.9264 0 -M V30 76 H -6.4844 -5.6625 4.7981 0 -M V30 77 H -7.2653 -4.9642 3.3285 0 -M V30 78 H -4.6072 -4.5426 4.1892 0 -M V30 79 N 3.6993 -2.3691 5.2408 0 -M V30 80 C 4.7456 -3.4002 5.1786 0 -M V30 81 C 5.3321 -3.4902 6.5695 0 -M V30 82 C 6.6464 -4.2031 6.6118 0 -M V30 83 C 6.8578 -4.8281 5.2286 0 -M V30 84 C 7.0815 -3.6419 4.2947 0 -M V30 85 C 5.7348 -2.9557 4.1510 0 -M V30 86 N 5.1750 -3.2210 2.8310 0 -M V30 87 H 4.2131 -4.3406 4.8920 0 -M V30 88 H 5.4991 -2.4458 6.9117 0 -M V30 89 H 4.6259 -4.0410 7.2166 0 -M V30 90 H 7.4971 -3.4842 6.7331 0 -M V30 91 H 6.7028 -4.9457 7.4132 0 -M V30 92 H 7.7469 -5.4658 5.3144 0 -M V30 93 H 5.9760 -5.4127 4.9439 0 -M V30 94 H 7.7453 -2.9015 4.8151 0 -M V30 95 H 7.5312 -3.9272 3.3456 0 -M V30 96 H 5.8365 -1.8363 4.2062 0 -M V30 97 N -0.2313 4.7317 4.6410 0 -M V30 98 C 0.1393 6.1533 4.5786 0 -M V30 99 C -0.0754 6.7063 5.9696 0 -M V30 100 C -0.1143 8.2010 6.0119 0 -M V30 101 C 0.3210 8.6963 4.6286 0 -M V30 102 C -0.8187 8.2975 3.6951 0 -M V30 103 C -0.7404 6.7881 3.5513 0 -M V30 104 N -0.2313 6.4357 2.2312 0 -M V30 105 H 1.2198 6.1618 4.2916 0 -M V30 106 H -1.0633 6.3292 6.3121 0 -M V30 107 H 0.7548 6.3696 6.6164 0 -M V30 108 H -1.1621 8.5787 6.1335 0 -M V30 109 H 0.5011 8.6207 6.8131 0 -M V30 110 H 0.4293 9.7851 4.7144 0 -M V30 111 H 1.2678 8.2245 4.3435 0 -M V30 112 H -1.7915 8.5026 4.2158 0 -M V30 113 H -0.7965 8.8296 2.7460 0 -M V30 114 H -1.7608 6.3169 3.6068 0 -M V30 115 N -1.5219 -5.3789 -3.4557 0 -M V30 116 C -0.6502 -6.0829 -4.4078 0 -M V30 117 C -1.4667 -7.2310 -4.9573 0 -M V30 118 C -0.6383 -8.2697 -5.6445 0 -M V30 119 C 0.7772 -7.6965 -5.7721 0 -M V30 120 C 1.3092 -7.6490 -4.3424 0 -M V30 121 C 0.5551 -6.5299 -3.6465 0 -M V30 122 N 1.4295 -5.3789 -3.4557 0 -M V30 123 H -0.4110 -5.3291 -5.1981 0 -M V30 124 H -1.9640 -7.7118 -4.0872 0 -M V30 125 H -2.1892 -6.8320 -5.6919 0 -M V30 126 H -0.5195 -9.1840 -5.0080 0 -M V30 127 H -1.0501 -8.5716 -6.6120 0 -M V30 128 H 1.3358 -8.4000 -6.4027 0 -M V30 129 H 0.7376 -6.7007 -6.2275 0 -M V30 130 H 1.0024 -8.5930 -3.8187 0 -M V30 131 H 2.3913 -7.5435 -4.2950 0 -M V30 132 H 0.2377 -6.8315 -2.6098 0 -M V30 133 N -5.2458 1.4088 -3.6806 0 -M V30 134 C -5.7902 2.7297 -4.0283 0 -M V30 135 C -6.9776 2.4724 -4.9287 0 -M V30 136 C -7.4236 3.6865 -5.6801 0 -M V30 137 C -6.6552 4.8773 -5.0970 0 -M V30 138 C -5.2077 4.6558 -5.5272 0 -M V30 139 C -4.6944 3.4888 -4.7029 0 -M V30 140 N -3.7701 3.9648 -3.6806 0 -M V30 141 H -6.0994 3.1844 -3.0548 0 -M V30 142 H -6.6539 1.7112 -5.6712 0 -M V30 143 H -7.8241 2.1269 -4.3083 0 -M V30 144 H -7.1073 3.6410 -6.7539 0 -M V30 145 H -8.5067 3.8363 -5.6435 0 -M V30 146 H -7.0934 5.7753 -5.5511 0 -M V30 147 H -6.7605 4.8923 -4.0066 0 -M V30 148 H -5.2049 4.3000 -6.5916 0 -M V30 149 H -4.5975 5.5531 -5.4435 0 -M V30 150 H -4.0930 2.7751 -5.3318 0 -M V30 151 N 5.7193 1.4642 -4.0422 0 -M V30 152 C 5.8932 2.5711 -4.9943 0 -M V30 153 C 7.2958 2.4380 -5.5438 0 -M V30 154 C 7.7810 3.6748 -6.2310 0 -M V30 155 C 6.5769 4.6140 -6.3587 0 -M V30 156 C 6.2698 5.0510 -4.9290 0 -M V30 157 C 5.6777 3.8384 -4.2331 0 -M V30 158 N 4.2436 4.0201 -4.0422 0 -M V30 159 H 5.1208 2.4013 -5.7847 0 -M V30 160 H 7.9608 2.2477 -4.6737 0 -M V30 161 H 7.3114 1.6128 -6.2785 0 -M V30 162 H 8.5135 4.2348 -5.5945 0 -M V30 163 H 8.2484 3.4691 -7.1986 0 -M V30 164 H 6.9069 5.4495 -6.9892 0 -M V30 165 H 5.7344 4.0818 -6.8141 0 -M V30 166 H 7.2407 5.2573 -4.4052 0 -M V30 167 H 5.6374 5.9354 -4.8815 0 -M V30 168 H 6.0976 3.7143 -3.1964 0 -M V30 169 Br 1.1870 0.0000 0.0000 0 -M V30 170 Br -1.1870 0.0000 0.0000 0 -M V30 END ATOM -M V30 BEGIN BOND -M V30 1 1 1 2 -M V30 2 2 2 3 -M V30 3 1 3 4 -M V30 4 1 4 5 -M V30 5 2 4 6 -M V30 6 1 6 7 -M V30 7 1 7 8 -M V30 8 2 7 9 -M V30 9 1 9 2 -M V30 10 1 1 10 -M V30 11 1 3 11 -M V30 12 1 5 12 -M V30 13 1 6 13 -M V30 14 1 8 14 -M V30 15 1 9 15 -M V30 16 1 16 17 -M V30 17 2 17 18 -M V30 18 1 18 19 -M V30 19 1 19 20 -M V30 20 2 19 21 -M V30 21 1 21 22 -M V30 22 1 22 23 -M V30 23 2 22 24 -M V30 24 1 24 17 -M V30 25 1 16 25 -M V30 26 1 18 26 -M V30 27 1 20 27 -M V30 28 1 21 28 -M V30 29 1 23 29 -M V30 30 1 24 30 -M V30 31 1 31 32 -M V30 32 2 32 33 -M V30 33 1 33 34 -M V30 34 1 34 35 -M V30 35 2 34 36 -M V30 36 1 36 37 -M V30 37 1 37 38 -M V30 38 2 37 39 -M V30 39 1 39 32 -M V30 40 1 31 40 -M V30 41 1 33 41 -M V30 42 1 35 42 -M V30 43 1 36 43 -M V30 44 1 38 44 -M V30 45 1 39 45 -M V30 46 1 46 47 -M V30 47 2 47 48 -M V30 48 1 48 49 -M V30 49 1 49 50 -M V30 50 2 49 51 -M V30 51 1 51 52 -M V30 52 1 52 53 -M V30 53 2 52 54 -M V30 54 1 54 47 -M V30 55 1 46 55 -M V30 56 1 48 56 -M V30 57 1 50 57 -M V30 58 1 51 58 -M V30 59 1 53 59 -M V30 60 1 54 60 -M V30 61 1 61 62 -M V30 62 1 62 63 -M V30 63 1 63 64 -M V30 64 1 64 65 -M V30 65 1 65 66 -M V30 66 1 66 67 -M V30 67 1 67 68 -M V30 68 1 67 62 -M V30 69 1 62 69 -M V30 70 1 63 70 -M V30 71 1 63 71 -M V30 72 1 64 72 -M V30 73 1 64 73 -M V30 74 1 65 74 -M V30 75 1 65 75 -M V30 76 1 66 76 -M V30 77 1 66 77 -M V30 78 1 67 78 -M V30 79 1 79 80 -M V30 80 1 80 81 -M V30 81 1 81 82 -M V30 82 1 82 83 -M V30 83 1 83 84 -M V30 84 1 84 85 -M V30 85 1 85 86 -M V30 86 1 85 80 -M V30 87 1 80 87 -M V30 88 1 81 88 -M V30 89 1 81 89 -M V30 90 1 82 90 -M V30 91 1 82 91 -M V30 92 1 83 92 -M V30 93 1 83 93 -M V30 94 1 84 94 -M V30 95 1 84 95 -M V30 96 1 85 96 -M V30 97 1 97 98 -M V30 98 1 98 99 -M V30 99 1 99 100 -M V30 100 1 100 101 -M V30 101 1 101 102 -M V30 102 1 102 103 -M V30 103 1 103 104 -M V30 104 1 103 98 -M V30 105 1 98 105 -M V30 106 1 99 106 -M V30 107 1 99 107 -M V30 108 1 100 108 -M V30 109 1 100 109 -M V30 110 1 101 110 -M V30 111 1 101 111 -M V30 112 1 102 112 -M V30 113 1 102 113 -M V30 114 1 103 114 -M V30 115 1 115 116 -M V30 116 1 116 117 -M V30 117 1 117 118 -M V30 118 1 118 119 -M V30 119 1 119 120 -M V30 120 1 120 121 -M V30 121 1 121 122 -M V30 122 1 121 116 -M V30 123 1 116 123 -M V30 124 1 117 124 -M V30 125 1 117 125 -M V30 126 1 118 126 -M V30 127 1 118 127 -M V30 128 1 119 128 -M V30 129 1 119 129 -M V30 130 1 120 130 -M V30 131 1 120 131 -M V30 132 1 121 132 -M V30 133 1 133 134 -M V30 134 1 134 135 -M V30 135 1 135 136 -M V30 136 1 136 137 -M V30 137 1 137 138 -M V30 138 1 138 139 -M V30 139 1 139 140 -M V30 140 1 139 134 -M V30 141 1 134 141 -M V30 142 1 135 142 -M V30 143 1 135 143 -M V30 144 1 136 144 -M V30 145 1 136 145 -M V30 146 1 137 146 -M V30 147 1 137 147 -M V30 148 1 138 148 -M V30 149 1 138 149 -M V30 150 1 139 150 -M V30 151 1 151 152 -M V30 152 1 152 153 -M V30 153 1 153 154 -M V30 154 1 154 155 -M V30 155 1 155 156 -M V30 156 1 156 157 -M V30 157 1 157 158 -M V30 158 1 157 152 -M V30 159 1 152 159 -M V30 160 1 153 160 -M V30 161 1 153 161 -M V30 162 1 154 162 -M V30 163 1 154 163 -M V30 164 1 155 164 -M V30 165 1 155 165 -M V30 166 1 156 166 -M V30 167 1 156 167 -M V30 168 1 157 168 -M V30 169 2 1 61 -M V30 170 2 16 68 -M V30 171 2 8 79 -M V30 172 2 31 86 -M V30 173 2 5 97 -M V30 174 2 46 104 -M V30 175 2 20 115 -M V30 176 2 38 122 -M V30 177 2 23 133 -M V30 178 2 50 140 -M V30 179 2 35 151 -M V30 180 2 53 158 -M V30 181 1 169 170 -M V30 END BOND -M V30 END CTAB -M END - -$$$$ diff --git a/python/examples/data/stk_4.mol b/python/examples/data/stk_4.mol deleted file mode 100644 index 7195b102e..000000000 --- a/python/examples/data/stk_4.mol +++ /dev/null @@ -1,44 +0,0 @@ - - RDKit 3D - - 0 0 0 0 0 0 0 0 0 0999 V3000 -M V30 BEGIN CTAB -M V30 COUNTS 15 15 0 0 0 -M V30 BEGIN ATOM -M V30 1 C 2.2158 0.0324 -0.0218 0 -M V30 2 C 0.7287 0.0297 -0.0118 0 -M V30 3 C 0.0383 -1.1614 0.0667 0 -M V30 4 C -1.3527 -1.1977 0.0782 0 -M V30 5 C -2.0901 -0.0334 0.0108 0 -M V30 6 C -1.3920 1.1548 -0.0676 0 -M V30 7 C -0.0036 1.1972 -0.0794 0 -M V30 8 H 2.6349 -0.0844 1.0025 0 -M V30 9 H 2.5646 -0.8265 -0.6062 0 -M V30 10 H 2.5418 1.0131 -0.3925 0 -M V30 11 H 0.6086 -2.1021 0.1214 0 -M V30 12 H -1.8853 -2.1304 0.1396 0 -M V30 13 H -3.1787 -0.0848 0.0212 0 -M V30 14 H -1.9686 2.0588 -0.1199 0 -M V30 15 H 0.5383 2.1347 -0.1412 0 -M V30 END ATOM -M V30 BEGIN BOND -M V30 1 1 1 2 -M V30 2 2 2 3 -M V30 3 1 3 4 -M V30 4 2 4 5 -M V30 5 1 5 6 -M V30 6 2 6 7 -M V30 7 1 7 2 -M V30 8 1 1 8 -M V30 9 1 1 9 -M V30 10 1 1 10 -M V30 11 1 3 11 -M V30 12 1 4 12 -M V30 13 1 5 13 -M V30 14 1 6 14 -M V30 15 1 7 15 -M V30 END BOND -M V30 END CTAB -M END - -$$$$