openff-toolkit 0.18.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) hide show
  1. devtools/scripts/build_cookiecutter_json.py +22 -0
  2. docs/conf.py +296 -0
  3. docs/conftest.py +23 -0
  4. examples/conformer_energies/conformer_energies.py +143 -0
  5. examples/deprecated/SMIRNOFF_comparison/compare_molecule_energies.py +48 -0
  6. examples/deprecated/SMIRNOFF_comparison/compare_set_energies.py +58 -0
  7. examples/deprecated/liquid_box/create_mol2_pdb/create_mol2_pdb.py +193 -0
  8. examples/deprecated/liquid_box/openff_simulation.py +72 -0
  9. examples/deprecated/mixedFF_structure/generate_mixedFF_complex.py +56 -0
  10. examples/deprecated/testing/test_impropers/tleap_tools.py +120 -0
  11. examples/examples_helper.py +61 -0
  12. openff/toolkit/__init__.py +101 -0
  13. openff/toolkit/_tests/__init__.py +0 -0
  14. openff/toolkit/_tests/_stale_tests.py +146 -0
  15. openff/toolkit/_tests/conftest.py +108 -0
  16. openff/toolkit/_tests/create_molecules.py +494 -0
  17. openff/toolkit/_tests/mocking.py +145 -0
  18. openff/toolkit/_tests/molecule/__init__.py +1 -0
  19. openff/toolkit/_tests/molecule/test_state_enumeration.py +302 -0
  20. openff/toolkit/_tests/test_energies.py +136 -0
  21. openff/toolkit/_tests/test_examples.py +109 -0
  22. openff/toolkit/_tests/test_forcefield.py +3864 -0
  23. openff/toolkit/_tests/test_interchange.py +19 -0
  24. openff/toolkit/_tests/test_io.py +19 -0
  25. openff/toolkit/_tests/test_links.py +73 -0
  26. openff/toolkit/_tests/test_mm_molecule.py +404 -0
  27. openff/toolkit/_tests/test_molecule.py +4246 -0
  28. openff/toolkit/_tests/test_nagl.py +169 -0
  29. openff/toolkit/_tests/test_parameter_plugins.py +89 -0
  30. openff/toolkit/_tests/test_parameters.py +2898 -0
  31. openff/toolkit/_tests/test_toolkit_io.py +1088 -0
  32. openff/toolkit/_tests/test_toolkits.py +4418 -0
  33. openff/toolkit/_tests/test_topology.py +2485 -0
  34. openff/toolkit/_tests/test_utils.py +101 -0
  35. openff/toolkit/_tests/test_utils_callback.py +178 -0
  36. openff/toolkit/_tests/test_utils_collections.py +263 -0
  37. openff/toolkit/_tests/test_utils_serialization.py +168 -0
  38. openff/toolkit/_tests/utils.py +1747 -0
  39. openff/toolkit/data/README.md +8 -0
  40. openff/toolkit/data/molecules/AlkEthOH_test_filt1_ff.mol2 +2026 -0
  41. openff/toolkit/data/molecules/AlkEthOH_test_filt1_tripos.mol2 +2026 -0
  42. openff/toolkit/data/molecules/AlkEthOH_tripos.tar.gz +0 -0
  43. openff/toolkit/data/molecules/CID20742535_anion.sdf +50 -0
  44. openff/toolkit/data/molecules/CID20742535_neutral.sdf +51 -0
  45. openff/toolkit/data/molecules/FreeSolv.tar.gz +0 -0
  46. openff/toolkit/data/molecules/MiniDrugBank.sdf +33988 -0
  47. openff/toolkit/data/molecules/MiniDrugBank_tripos.mol2 +35462 -0
  48. openff/toolkit/data/molecules/PT2385.sdf +90 -0
  49. openff/toolkit/data/molecules/QL8.sdf +401 -0
  50. openff/toolkit/data/molecules/README.md +21 -0
  51. openff/toolkit/data/molecules/benzene.crd +8 -0
  52. openff/toolkit/data/molecules/benzene.mol2 +34 -0
  53. openff/toolkit/data/molecules/benzene.top +166 -0
  54. openff/toolkit/data/molecules/butane_multi.sdf +231 -0
  55. openff/toolkit/data/molecules/cyclohexane.mol2 +44 -0
  56. openff/toolkit/data/molecules/ethanol.mol2 +25 -0
  57. openff/toolkit/data/molecules/ethanol.sdf +23 -0
  58. openff/toolkit/data/molecules/ethanol_partial_charges.sdf +26 -0
  59. openff/toolkit/data/molecules/ethanol_reordered.mol2 +25 -0
  60. openff/toolkit/data/molecules/ethanol_reordered.sdf +23 -0
  61. openff/toolkit/data/molecules/ethene_rdkit.sdf +17 -0
  62. openff/toolkit/data/molecules/laromustine_ff.mol2 +71 -0
  63. openff/toolkit/data/molecules/laromustine_tripos.mol2 +71 -0
  64. openff/toolkit/data/molecules/methane_multiconformer.sdf +32 -0
  65. openff/toolkit/data/molecules/methane_multiconformer_properties.sdf +45 -0
  66. openff/toolkit/data/molecules/nh4.pdb +7 -0
  67. openff/toolkit/data/molecules/po4_phenylphosphate.pdb +46 -0
  68. openff/toolkit/data/molecules/ruxolitinib_conformers.sdf +910 -0
  69. openff/toolkit/data/molecules/toluene.mol2 +38 -0
  70. openff/toolkit/data/molecules/toluene.mol2.gz +0 -0
  71. openff/toolkit/data/molecules/toluene.pdb +30 -0
  72. openff/toolkit/data/molecules/toluene.sdf +36 -0
  73. openff/toolkit/data/molecules/toluene_charged.mol2 +38 -0
  74. openff/toolkit/data/molecules/z_3_hydroxy_propenal.sdf +23 -0
  75. openff/toolkit/data/proteins/5tbm_complex_solv.pdb +1928 -0
  76. openff/toolkit/data/proteins/5tbm_complex_solv_box.pdb +19563 -0
  77. openff/toolkit/data/proteins/CTerminal_ALA.pdb +20 -0
  78. openff/toolkit/data/proteins/CTerminal_ALA.sdf +43 -0
  79. openff/toolkit/data/proteins/CTerminal_ALA_ALA.pdb +30 -0
  80. openff/toolkit/data/proteins/CTerminal_ALA_ALA_misnamedH.pdb +30 -0
  81. openff/toolkit/data/proteins/CTerminal_ARG.pdb +34 -0
  82. openff/toolkit/data/proteins/CTerminal_TRP.pdb +34 -0
  83. openff/toolkit/data/proteins/MainChain_ALA.pdb +25 -0
  84. openff/toolkit/data/proteins/MainChain_ALA.sdf +52 -0
  85. openff/toolkit/data/proteins/MainChain_ALA_ALA.pdb +35 -0
  86. openff/toolkit/data/proteins/MainChain_ALA_ALA.sdf +69 -0
  87. openff/toolkit/data/proteins/MainChain_ALA_ALA_icodes.pdb +35 -0
  88. openff/toolkit/data/proteins/MainChain_ALA_ALA_no_hydrogens.pdb +17 -0
  89. openff/toolkit/data/proteins/MainChain_ARG.pdb +39 -0
  90. openff/toolkit/data/proteins/MainChain_ARG.sdf +81 -0
  91. openff/toolkit/data/proteins/MainChain_CYM.pdb +25 -0
  92. openff/toolkit/data/proteins/MainChain_CYS.pdb +26 -0
  93. openff/toolkit/data/proteins/MainChain_CYX.pdb +48 -0
  94. openff/toolkit/data/proteins/MainChain_CYX.sdf +96 -0
  95. openff/toolkit/data/proteins/MainChain_GLH.sdf +64 -0
  96. openff/toolkit/data/proteins/MainChain_GLU.sdf +63 -0
  97. openff/toolkit/data/proteins/MainChain_HID.pdb +32 -0
  98. openff/toolkit/data/proteins/MainChain_HIE.pdb +32 -0
  99. openff/toolkit/data/proteins/MainChain_HIE.sdf +67 -0
  100. openff/toolkit/data/proteins/MainChain_HIP.pdb +33 -0
  101. openff/toolkit/data/proteins/MainChain_HIP.sdf +70 -0
  102. openff/toolkit/data/proteins/MainChain_PRO.pdb +29 -0
  103. openff/toolkit/data/proteins/MainChain_TRP.pdb +39 -0
  104. openff/toolkit/data/proteins/NTerminal_ALA.pdb +21 -0
  105. openff/toolkit/data/proteins/NTerminal_ALA.sdf +45 -0
  106. openff/toolkit/data/proteins/NTerminal_ALA_ALA.pdb +31 -0
  107. openff/toolkit/data/proteins/NTerminal_ARG.pdb +35 -0
  108. openff/toolkit/data/proteins/NTerminal_TRP.pdb +35 -0
  109. openff/toolkit/data/proteins/T4-protein-unprocessed-4w51.pdb +1892 -0
  110. openff/toolkit/data/proteins/T4-protein.mol2 +5461 -0
  111. openff/toolkit/data/proteins/T4-protein.pdb +2637 -0
  112. openff/toolkit/data/proteins/T4-protein.sdf +5318 -0
  113. openff/toolkit/data/proteins/T4_protein_waters.pdb +2965 -0
  114. openff/toolkit/data/proteins/TwoMol_SER_CYS.pdb +50 -0
  115. openff/toolkit/data/proteins/aa_residues_substructures_explicit_bond_orders_with_caps.json +6435 -0
  116. openff/toolkit/data/proteins/aa_residues_substructures_explicit_bond_orders_with_caps_explicit_connectivity.json +6675 -0
  117. openff/toolkit/data/proteins/aa_residues_substructures_with_caps.json +6297 -0
  118. openff/toolkit/data/proteins/ace-ZZZ-gly-nme.pdb +78 -0
  119. openff/toolkit/data/proteins/ace-ZZZ-gly-nme.sdf +98 -0
  120. openff/toolkit/data/proteins/ace-a10-nme.sdf +229 -0
  121. openff/toolkit/data/proteins/ace-ala-nh2.pdb +21 -0
  122. openff/toolkit/data/proteins/fluoresceine_dyed_helix_capped.pdb +338 -0
  123. openff/toolkit/data/proteins/neutral_arginine.pdb +31 -0
  124. openff/toolkit/data/proteins/split_chain.pdb +74 -0
  125. openff/toolkit/data/proteins/split_chain_reordered.pdb +74 -0
  126. openff/toolkit/data/reference_energies/README.md +6 -0
  127. openff/toolkit/data/reference_energies/reference_0.8.0.json +1 -0
  128. openff/toolkit/data/reference_energies/reference_0.8.0.json.txt +180 -0
  129. openff/toolkit/data/reference_energies/reference_after_1007.json +1 -0
  130. openff/toolkit/data/reference_energies/reference_after_1007.json.txt +350 -0
  131. openff/toolkit/data/reference_energies/reference_after_802.json +1 -0
  132. openff/toolkit/data/reference_energies/reference_after_802.json.txt +291 -0
  133. openff/toolkit/data/systems/README.md +3 -0
  134. openff/toolkit/data/systems/amber/cyclohexane_ethanol_0.4_0.6.inpcrd +1511 -0
  135. openff/toolkit/data/systems/amber/cyclohexane_ethanol_0.4_0.6.prmtop +13367 -0
  136. openff/toolkit/data/systems/monomers/butanol.mol2 +38 -0
  137. openff/toolkit/data/systems/monomers/butanol.sdf +88 -0
  138. openff/toolkit/data/systems/monomers/cyclohexane.mol2 +45 -0
  139. openff/toolkit/data/systems/monomers/cyclohexane.sdf +105 -0
  140. openff/toolkit/data/systems/monomers/ethanol.mol2 +26 -0
  141. openff/toolkit/data/systems/monomers/ethanol.sdf +58 -0
  142. openff/toolkit/data/systems/monomers/methane.mol2 +18 -0
  143. openff/toolkit/data/systems/monomers/methane.sdf +38 -0
  144. openff/toolkit/data/systems/monomers/propane.mol2 +30 -0
  145. openff/toolkit/data/systems/monomers/propane.sdf +68 -0
  146. openff/toolkit/data/systems/monomers/tip3p_water.mol2 +14 -0
  147. openff/toolkit/data/systems/monomers/water.mol2 +14 -0
  148. openff/toolkit/data/systems/monomers/water.sdf +28 -0
  149. openff/toolkit/data/systems/packmol_boxes/cyclohexane_ethanol_0.4_0.6.pdb +6272 -0
  150. openff/toolkit/data/systems/packmol_boxes/cyclohexane_water.pdb +5524 -0
  151. openff/toolkit/data/systems/packmol_boxes/ethanol_water.pdb +5174 -0
  152. openff/toolkit/data/systems/packmol_boxes/propane_methane_butanol_0.2_0.3_0.5.pdb +7959 -0
  153. openff/toolkit/data/systems/test_systems/1_cyclohexane_1_ethanol.pdb +61 -0
  154. openff/toolkit/data/systems/test_systems/1_ethanol.pdb +24 -0
  155. openff/toolkit/data/systems/test_systems/1_ethanol_no_conect.pdb +15 -0
  156. openff/toolkit/data/systems/test_systems/1_ethanol_reordered.pdb +24 -0
  157. openff/toolkit/data/systems/test_systems/PE.pdb +67 -0
  158. openff/toolkit/data/systems/test_systems/README.md +3 -0
  159. openff/toolkit/data/systems/test_systems/T4_lysozyme_water_ions.pdb +29240 -0
  160. openff/toolkit/data/test_forcefields/Frosst_AlkEthOH.offxml +61 -0
  161. openff/toolkit/data/test_forcefields/Frosst_AlkEthOH_GBSA.offxml +78 -0
  162. openff/toolkit/data/test_forcefields/Frosst_AlkEthOH_MDL.offxml +62 -0
  163. openff/toolkit/data/test_forcefields/Frosst_AlkEthOH_parmAtFrosst.offxml +64 -0
  164. openff/toolkit/data/test_forcefields/GBSA_HCT-1.0.offxml +21 -0
  165. openff/toolkit/data/test_forcefields/GBSA_OBC1-1.0.offxml +18 -0
  166. openff/toolkit/data/test_forcefields/GBSA_OBC2-1.0.offxml +18 -0
  167. openff/toolkit/data/test_forcefields/README.md +23 -0
  168. openff/toolkit/data/test_forcefields/ammonia_minimal.offxml +27 -0
  169. openff/toolkit/data/test_forcefields/benzene_minimal.offxml +29 -0
  170. openff/toolkit/data/test_forcefields/chargeincrement-test.offxml +16 -0
  171. openff/toolkit/data/test_forcefields/frcmod.Frosst_AlkEthOH_withIDs +85 -0
  172. openff/toolkit/data/test_forcefields/ion_charges.offxml +18 -0
  173. openff/toolkit/data/test_forcefields/mangled.offxml +9 -0
  174. openff/toolkit/data/test_forcefields/old/README.md +9 -0
  175. openff/toolkit/data/test_forcefields/old/hbonds.offxml +11 -0
  176. openff/toolkit/data/test_forcefields/old/test_ff_0_0_2_spec_0_1.offxml +332 -0
  177. openff/toolkit/data/test_forcefields/old/test_ff_0_0_2_spec_0_2.offxml +338 -0
  178. openff/toolkit/data/test_forcefields/old/test_ff_0_0_2_spec_0_3.offxml +329 -0
  179. openff/toolkit/data/test_forcefields/old/test_ff_0_0_4_fixed_spec_0_1.offxml +342 -0
  180. openff/toolkit/data/test_forcefields/old/test_ff_0_0_4_fixed_spec_0_2.offxml +348 -0
  181. openff/toolkit/data/test_forcefields/old/test_ff_0_0_4_fixed_spec_0_3.offxml +337 -0
  182. openff/toolkit/data/test_forcefields/old/test_ff_0_0_4_spec_0_1.offxml +340 -0
  183. openff/toolkit/data/test_forcefields/old/test_ff_0_0_4_spec_0_2.offxml +346 -0
  184. openff/toolkit/data/test_forcefields/old/test_ff_0_0_4_spec_0_3.offxml +337 -0
  185. openff/toolkit/data/test_forcefields/smirff99Frosst_reference_0_1_spec.offxml +349 -0
  186. openff/toolkit/data/test_forcefields/smirnoff99Frosst_experimental.offxml +343 -0
  187. openff/toolkit/data/test_forcefields/smirnoff99Frosst_reference_0_1_spec.offxml +349 -0
  188. openff/toolkit/data/test_forcefields/smirnoff99Frosst_reference_0_2_spec.offxml +356 -0
  189. openff/toolkit/data/test_forcefields/test_forcefield.offxml +346 -0
  190. openff/toolkit/data/test_forcefields/tip3p.offxml +22 -0
  191. openff/toolkit/data/test_forcefields/unsupported_smirnoff_version.offxml +9 -0
  192. openff/toolkit/topology/__init__.py +43 -0
  193. openff/toolkit/topology/_mm_molecule.py +663 -0
  194. openff/toolkit/topology/molecule.py +6102 -0
  195. openff/toolkit/topology/topology.py +2555 -0
  196. openff/toolkit/typing/__init__.py +1 -0
  197. openff/toolkit/typing/engines/__init__.py +1 -0
  198. openff/toolkit/typing/engines/smirnoff/__init__.py +31 -0
  199. openff/toolkit/typing/engines/smirnoff/forcefield.py +1440 -0
  200. openff/toolkit/typing/engines/smirnoff/io.py +234 -0
  201. openff/toolkit/typing/engines/smirnoff/parameters.py +3839 -0
  202. openff/toolkit/typing/engines/smirnoff/plugins.py +91 -0
  203. openff/toolkit/utils/__init__.py +57 -0
  204. openff/toolkit/utils/_viz.py +104 -0
  205. openff/toolkit/utils/ambertools_wrapper.py +507 -0
  206. openff/toolkit/utils/base_wrapper.py +268 -0
  207. openff/toolkit/utils/builtin_wrapper.py +136 -0
  208. openff/toolkit/utils/callback.py +187 -0
  209. openff/toolkit/utils/collections.py +247 -0
  210. openff/toolkit/utils/constants.py +18 -0
  211. openff/toolkit/utils/exceptions.py +766 -0
  212. openff/toolkit/utils/nagl_wrapper.py +164 -0
  213. openff/toolkit/utils/openeye_wrapper.py +2750 -0
  214. openff/toolkit/utils/rdkit_wrapper.py +3302 -0
  215. openff/toolkit/utils/serialization.py +466 -0
  216. openff/toolkit/utils/toolkit_registry.py +509 -0
  217. openff/toolkit/utils/toolkits.py +217 -0
  218. openff/toolkit/utils/utils.py +805 -0
  219. openff_toolkit-0.18.0.dist-info/METADATA +109 -0
  220. openff_toolkit-0.18.0.dist-info/RECORD +231 -0
  221. openff_toolkit-0.18.0.dist-info/WHEEL +5 -0
  222. openff_toolkit-0.18.0.dist-info/licenses/LICENSE +21 -0
  223. openff_toolkit-0.18.0.dist-info/top_level.txt +5 -0
  224. utilities/deprecated/convert_frosst/convert_frcmod_0.1.py +251 -0
  225. utilities/deprecated/convert_frosst/convert_frcmod_0.2.py +249 -0
  226. utilities/deprecated/convert_frosst/convert_frcmod_0.3.py +249 -0
  227. utilities/make_substructure_dict/_cif_to_substructure_dict.py +955 -0
  228. utilities/make_substructure_dict/_make_chemical_substructures.py +46 -0
  229. utilities/make_substructure_dict/_make_metadata_assignment_substructures.py +35 -0
  230. utilities/test_plugins/custom_plugins/handler_plugins.py +48 -0
  231. utilities/test_plugins/setup.py +19 -0
@@ -0,0 +1,766 @@
1
+ from collections import defaultdict
2
+ from collections.abc import Mapping
3
+ from typing import TYPE_CHECKING, Optional
4
+
5
+ if TYPE_CHECKING:
6
+ from openmm.app import Atom as OpenMMAtom
7
+ from openmm.app import Residue as OpenMMResidue
8
+ from openmm.app import Topology as OpenMMTopology
9
+
10
+
11
+ class OpenFFToolkitException(Exception):
12
+ """Base exception for custom exceptions raised by the OpenFF Toolkit"""
13
+
14
+ def __init__(self, msg: str):
15
+ super().__init__(msg)
16
+ self.msg = msg
17
+
18
+ def __str__(self) -> str:
19
+ return self.msg
20
+
21
+
22
+ class IncompatibleUnitError(OpenFFToolkitException):
23
+ """
24
+ Exception for when a parameter is in the wrong units for a ParameterHandler's unit system
25
+ """
26
+
27
+
28
+ class IncompatibleShapeError(OpenFFToolkitException):
29
+ """
30
+ Exception for when a value is in the wrong shape
31
+ """
32
+
33
+
34
+ class IncompatibleTypeError(OpenFFToolkitException):
35
+ """
36
+ Exception for when a value is in an incompatible type
37
+ """
38
+
39
+
40
+ class MissingPackageError(OpenFFToolkitException):
41
+ """This function requires a package that is not installed."""
42
+
43
+
44
+ class ToolkitUnavailableException(OpenFFToolkitException):
45
+ """The requested toolkit is unavailable."""
46
+
47
+ # TODO: Allow toolkit to be specified and used in formatting/printing exception.
48
+
49
+
50
+ class LicenseError(ToolkitUnavailableException):
51
+ """This function requires a license that cannot be found."""
52
+
53
+
54
+ class InvalidToolkitError(OpenFFToolkitException):
55
+ """A non-toolkit object was received when a toolkit object was expected"""
56
+
57
+
58
+ class InvalidToolkitRegistryError(OpenFFToolkitException):
59
+ """An object other than a ToolkitRegistry or toolkit wrapper was received"""
60
+
61
+
62
+ class UndefinedStereochemistryError(OpenFFToolkitException):
63
+ """A molecule was attempted to be loaded with undefined stereochemistry"""
64
+
65
+
66
+ class GAFFAtomTypeWarning(RuntimeWarning):
67
+ """A warning raised if a loaded mol2 file possibly uses GAFF atom types."""
68
+
69
+
70
+ class ChargeMethodUnavailableError(OpenFFToolkitException):
71
+ """A toolkit does not support the requested partial_charge_method combination"""
72
+
73
+
74
+ class IncorrectNumConformersError(OpenFFToolkitException):
75
+ """The requested partial_charge_method expects a different number of conformers than was provided"""
76
+
77
+
78
+ class IncorrectNumConformersWarning(Warning):
79
+ """The requested partial_charge_method expects a different number of conformers than was provided"""
80
+
81
+
82
+ class ChargeCalculationError(OpenFFToolkitException):
83
+ """An unhandled error occurred in an external toolkit during charge calculation"""
84
+
85
+
86
+ class ConformerGenerationError(OpenFFToolkitException):
87
+ """Conformer generation via a wrapped toolkit failed."""
88
+
89
+
90
+ class InvalidIUPACNameError(OpenFFToolkitException):
91
+ """Failed to parse IUPAC name"""
92
+
93
+
94
+ class AntechamberNotFoundError(OpenFFToolkitException):
95
+ """The antechamber executable was not found"""
96
+
97
+
98
+ class MoleculeParseError(OpenFFToolkitException):
99
+ """The molecule could not be created from the given format"""
100
+
101
+
102
+ class SMILESParseError(OpenFFToolkitException, ValueError):
103
+ """The record could not be parsed into the given format"""
104
+
105
+
106
+ # TODO: Should warnings inherit from a sort of OpenFFToolkitWarning?
107
+ class AtomMappingWarning(UserWarning):
108
+ """A warning when dealing with atom maping or indices."""
109
+
110
+
111
+ class InChIParseError(MoleculeParseError, RuntimeError):
112
+ """The InChI record could not be parsed."""
113
+
114
+
115
+ class RadicalsNotSupportedError(OpenFFToolkitException):
116
+ """The OpenFF Toolkit does not currently support parsing molecules with radicals."""
117
+
118
+
119
+ class InvalidConformerError(OpenFFToolkitException):
120
+ """
121
+ This error is raised when the conformer added to the molecule
122
+ has a different connectivity to that already defined.
123
+ or any other conformer related issues.
124
+ """
125
+
126
+
127
+ class InvalidQCInputError(OpenFFToolkitException, AttributeError):
128
+ """
129
+ This error is raised when an input to Molecule.from_qcschema is invalid.
130
+ """
131
+
132
+
133
+ # TODO: Remove in favor of SMILESParseError? They are used in different modules
134
+ class SmilesParsingError(OpenFFToolkitException):
135
+ """
136
+ This error is raised when parsing a SMILES string results in an error.
137
+ """
138
+
139
+
140
+ class EmptyInChiError(OpenFFToolkitException):
141
+ """
142
+ This error is raised when a toolkit returns an empty InChi string, possibly due to bugs
143
+ in the underlying InChi code. For more context, see
144
+ https://github.com/openforcefield/openff-toolkit/issues/1897
145
+ """
146
+
147
+
148
+ class NotAttachedToMoleculeError(OpenFFToolkitException):
149
+ """Exception for when a component does not belong to a Molecule object, but is queried"""
150
+
151
+
152
+ class NotInTopologyError(OpenFFToolkitException):
153
+ """An object was not found in a topology."""
154
+
155
+
156
+ class RemapIndexError(OpenFFToolkitException):
157
+ """An error with indices used to remap a molecule"""
158
+
159
+
160
+ class AtomNotInTopologyError(NotInTopologyError):
161
+ """An atom was not found in a topology."""
162
+
163
+
164
+ class BondNotInTopologyError(NotInTopologyError):
165
+ """An bond was not found in a topology."""
166
+
167
+
168
+ class MoleculeNotInTopologyError(NotInTopologyError):
169
+ """A molecule was not found in a topology."""
170
+
171
+
172
+ class InvalidAtomMetadataError(OpenFFToolkitException):
173
+ """The program attempted to set atom metadata to an invalid type"""
174
+
175
+
176
+ class BondExistsError(OpenFFToolkitException):
177
+ """The program attempted to add a bond that already exists"""
178
+
179
+
180
+ class ConstraintExsistsError(OpenFFToolkitException):
181
+ """Attempting to override a constraint that already exists with a specified distance."""
182
+
183
+
184
+ class DuplicateUniqueMoleculeError(OpenFFToolkitException):
185
+ """
186
+ Exception for when the user provides indistinguishable unique molecules when trying to identify atoms from a PDB
187
+ """
188
+
189
+
190
+ class NotBondedError(OpenFFToolkitException):
191
+ """
192
+ Exception for when a function requires a bond between two atoms, but none is present
193
+ """
194
+
195
+
196
+ class InvalidBondOrderError(OpenFFToolkitException):
197
+ """
198
+ Exception for passing a non-int to `Molecule.bond_order`
199
+ """
200
+
201
+
202
+ class InvalidBoxVectorsError(OpenFFToolkitException):
203
+ """
204
+ Exception for setting invalid box vectors
205
+ """
206
+
207
+
208
+ class InvalidPeriodicityError(OpenFFToolkitException):
209
+ """
210
+ Exception for setting invalid periodicity
211
+ """
212
+
213
+
214
+ class MissingUniqueMoleculesError(OpenFFToolkitException):
215
+ """
216
+ Exception for when unique_molecules is required but not found
217
+ """
218
+
219
+
220
+ class SMIRKSMismatchError(OpenFFToolkitException):
221
+ """
222
+ Exception for cases where smirks are inappropriate
223
+ for the environment type they are being parsed into
224
+ """
225
+
226
+
227
+ class SMIRKSParsingError(OpenFFToolkitException):
228
+ """
229
+ Exception for when SMIRKS are not parseable for any environment
230
+ """
231
+
232
+
233
+ class ChemicalEnvironmentParsingError(
234
+ SMIRKSParsingError,
235
+ ValueError,
236
+ ):
237
+ """
238
+ Exception for when SMARTS/SMIRKS are not parseable by a wrapped toolkit
239
+ """
240
+
241
+
242
+ class ParameterHandlerRegistrationError(OpenFFToolkitException):
243
+ """
244
+ Exception for errors in ParameterHandler registration
245
+ """
246
+
247
+
248
+ class SMIRNOFFVersionError(OpenFFToolkitException):
249
+ """
250
+ Exception thrown when an incompatible SMIRNOFF version data structure is attempted to be read.
251
+ """
252
+
253
+
254
+ class SMIRNOFFAromaticityError(OpenFFToolkitException):
255
+ """
256
+ Exception thrown when an incompatible SMIRNOFF aromaticity model is checked for compatibility.
257
+ """
258
+
259
+
260
+ class InvalidAromaticityModelError(OpenFFToolkitException, ValueError):
261
+ """
262
+ General exception for errors while setting the aromaticity model of a Topology.
263
+ """
264
+
265
+
266
+ class SMIRNOFFParseError(OpenFFToolkitException):
267
+ """
268
+ Error for when a SMIRNOFF data structure is not parseable by a ForceField
269
+ """
270
+
271
+ # TODO: Remove ParseError altogether by v0.11.0
272
+
273
+
274
+ class PartialChargeVirtualSitesError(OpenFFToolkitException):
275
+ """
276
+ Exception thrown when partial charges cannot be computed for a Molecule because the ForceField applies virtual
277
+ sites.
278
+ """
279
+
280
+
281
+ class SMIRNOFFSpecError(OpenFFToolkitException):
282
+ """
283
+ Exception for when data is noncompliant with the SMIRNOFF data specification.
284
+ """
285
+
286
+
287
+ class SMIRNOFFSpecUnimplementedError(OpenFFToolkitException):
288
+ """
289
+ Exception for when a portion of the SMIRNOFF specification is not yet implemented.
290
+ """
291
+
292
+
293
+ class FractionalBondOrderInterpolationMethodUnsupportedError(OpenFFToolkitException):
294
+ """
295
+ Exception for when an unsupported fractional bond order interpolation assignment method is called.
296
+ """
297
+
298
+
299
+ class NotEnoughPointsForInterpolationError(OpenFFToolkitException):
300
+ """Exception for when less than two points are provided for interpolation"""
301
+
302
+
303
+ class IncompatibleParameterError(OpenFFToolkitException):
304
+ """
305
+ Exception for when a set of parameters is scientifically/technically incompatible with another
306
+ """
307
+
308
+
309
+ class UnassignedValenceParameterException(OpenFFToolkitException):
310
+ """Exception raised when there are valence terms for which a ParameterHandler can't find parameters."""
311
+
312
+
313
+ class UnassignedBondParameterException(UnassignedValenceParameterException):
314
+ """Exception raised when there are bond terms for which a ParameterHandler can't find parameters."""
315
+
316
+
317
+ class UnassignedAngleParameterException(UnassignedValenceParameterException):
318
+ """Exception raised when there are angle terms for which a ParameterHandler can't find parameters."""
319
+
320
+
321
+ class UnassignedProperTorsionParameterException(UnassignedValenceParameterException):
322
+ """Exception raised when there are proper torsion terms for which a ParameterHandler can't find parameters."""
323
+
324
+
325
+ class UnassignedMoleculeChargeException(OpenFFToolkitException):
326
+ """Exception raised when no charge method is able to assign charges to a molecule."""
327
+
328
+
329
+ class DuplicateParameterError(OpenFFToolkitException):
330
+ """Exception raised when trying to add a ParameterType that already exists"""
331
+
332
+
333
+ class ParameterLookupError(OpenFFToolkitException):
334
+ """Exception raised when something goes wrong in a parameter lookup in
335
+ ParameterHandler.__getitem__"""
336
+
337
+
338
+ class DuplicateVirtualSiteTypeException(OpenFFToolkitException):
339
+ """Exception raised when trying to register two different virtual site classes with the same 'type'"""
340
+
341
+
342
+ class CallbackRegistrationError(OpenFFToolkitException, TypeError):
343
+ """Error raised when callback registration fails."""
344
+
345
+
346
+ class HierarchySchemeWithIteratorNameAlreadyRegisteredException(OpenFFToolkitException):
347
+ """Exception raised when trying to add a HierarchyScheme to a molecule
348
+ that already has one with the same iterator name"""
349
+
350
+
351
+ # TODO: Should be a subclass of KeyError? Should be replaced by KeyError?
352
+ class HierarchySchemeNotFoundException(OpenFFToolkitException):
353
+ """Exception raised when trying to access a HierarchyScheme from a molecule
354
+ that doesn't have one with the given iterator name"""
355
+
356
+
357
+ class HierarchyIteratorNameConflictError(OpenFFToolkitException):
358
+ """Exception raised when trying to access a hierarchy scheme with a name that
359
+ already exists as a `Topology` or `Molecule` attribute."""
360
+
361
+
362
+ class VirtualSitesUnsupportedError(OpenFFToolkitException):
363
+ """Exception raised when trying to store virtual sites in a `Molecule` or `Topology` object."""
364
+
365
+
366
+ class MissingIndexedAttributeError(OpenFFToolkitException, IndexError, KeyError, AttributeError):
367
+ """Error raised when an indexed attribute does not exist"""
368
+
369
+
370
+ class MissingPartialChargesError(OpenFFToolkitException, ValueError):
371
+ """Error raised when a molecule is missing partial charges in a context in which it is expected to have them."""
372
+
373
+
374
+ class MissingConformersError(OpenFFToolkitException, ValueError):
375
+ """Error raised when a molecule is missing conformer(s) in a context in which it is expected to have them."""
376
+
377
+
378
+ class MissingCMILESError(OpenFFToolkitException, KeyError):
379
+ """Error raised when attempting to convert an QC input to an OFF Molecule, but the CMILES can't be found
380
+ or isn't present."""
381
+
382
+
383
+ class UnsupportedMoleculeConversionError(OpenFFToolkitException):
384
+ """Error raised when attempting to instantiate a Molecule with insufficient inputs."""
385
+
386
+
387
+ class InconsistentStereochemistryError(OpenFFToolkitException):
388
+ """
389
+ Error raised when stereochemistry is inconsistent before and after conversions between molecule representations.
390
+ """
391
+
392
+
393
+ class UnsupportedFileTypeError(OpenFFToolkitException):
394
+ """Error raised when attempting to parse an unsupported file type."""
395
+
396
+
397
+ class OpenEyeError(OpenFFToolkitException):
398
+ """Error raised when an OpenEye Toolkits operation fails."""
399
+
400
+
401
+ class OpenEyeImportError(OpenFFToolkitException):
402
+ """Error raised when importing an OpenEye module fails."""
403
+
404
+
405
+ class MultipleMoleculesInPDBError(OpenFFToolkitException):
406
+ """Error raised when a multiple molecules are found when one was expected"""
407
+
408
+
409
+ class PDBMoleculeHasNoncontiguousAtomIndicesError(OpenFFToolkitException):
410
+ """Error raised when attempting to load a PDB file where at least one molecule has a gap in its atom
411
+ indices (this can not be represented in an OpenFF Topology as atoms in a molecule must be
412
+ contiguously indexed)"""
413
+
414
+
415
+ class MultipleComponentsInMoleculeWarning(UserWarning):
416
+ """Warning emitted when user attempts to make an OpenFF Molecule with multiple disconnected components"""
417
+
418
+
419
+ class WrongShapeError(OpenFFToolkitException):
420
+ """Error raised when an array of the wrong shape is found"""
421
+
422
+
423
+ class UnassignedChemistryInPDBError(OpenFFToolkitException, ValueError):
424
+ """
425
+ Error raised when a bond or atom in a polymer could not be assigned chemical information.
426
+ """
427
+
428
+ def __init__(
429
+ self,
430
+ msg: str | None = None,
431
+ substructure_library: dict[str, list[tuple]] | None = None,
432
+ omm_top: Optional["OpenMMTopology"] = None,
433
+ unassigned_bonds: list[tuple[int, int]] | None = None,
434
+ unassigned_atoms: list[int] | None = None,
435
+ matches: defaultdict[int, list[str]] | None = None,
436
+ ):
437
+ if omm_top is not None:
438
+ self.omm_top = omm_top
439
+ self._atoms: list[OpenMMAtom] = list(omm_top.atoms())
440
+ self._bonds: list[tuple[OpenMMAtom, OpenMMAtom]] = list(omm_top.bonds())
441
+
442
+ if not (substructure_library):
443
+ substructure_library = {}
444
+ self.substructure_library = substructure_library
445
+ self.unassigned_bonds = [] if unassigned_bonds is None else unassigned_bonds
446
+ self.unassigned_atoms = [] if unassigned_atoms is None else unassigned_atoms
447
+ self.matches = matches
448
+
449
+ message = ["Some bonds or atoms in the input could not be identified.", ""] if msg is None else [msg, ""]
450
+
451
+ message += [
452
+ *self.missing_hydrogens_hint(),
453
+ *self.multiple_chains_hint(),
454
+ *self.mismatched_atom_names_hint(),
455
+ *self.unknown_residue_hint(),
456
+ *self.assigned_residue_name_mismatch_hint(),
457
+ *self.unassigned_atoms_err(),
458
+ *self.unassigned_bonds_err(),
459
+ ]
460
+
461
+ super().__init__("\n".join(message))
462
+
463
+ def residue_of_atom_as_str(self, atom_index: int) -> str:
464
+ res = self._atoms[atom_index].residue
465
+ return self.fmt_residue(res.name, res.id, res.chain.id)
466
+
467
+ @staticmethod
468
+ def fmt_residue(name: str, num: int, chain: str = "") -> str:
469
+ if chain == "":
470
+ return f"{name}#{num:0>4}"
471
+ else:
472
+ return f"{chain}:{name}#{num:0>4}"
473
+
474
+ def unassigned_atoms_err(self) -> list[str]:
475
+ if self.unassigned_atoms and self.omm_top:
476
+ return [
477
+ (
478
+ f"Error: The following {len(self.unassigned_atoms)} atoms exist in the input "
479
+ + "but could not be assigned chemical information from the "
480
+ + "substructure library:"
481
+ ),
482
+ *(
483
+ f" Atom {i: >5} ({self._atoms[i].name}) in residue " + f"{self.residue_of_atom_as_str(i)}"
484
+ for i in self.unassigned_atoms
485
+ ),
486
+ "",
487
+ ]
488
+ return []
489
+
490
+ def unassigned_bonds_err(self) -> list[str]:
491
+ if not (self.unassigned_bonds and self.unassigned_atoms and self.omm_top):
492
+ return []
493
+
494
+ unassigned_bonds_with_assigned_atoms = [
495
+ (i_a, i_b)
496
+ for i_a, i_b in self.unassigned_bonds
497
+ if i_a not in self.unassigned_atoms and i_b not in self.unassigned_atoms
498
+ ]
499
+
500
+ elided_bonds_hint = []
501
+ if unassigned_bonds_with_assigned_atoms != self.unassigned_bonds:
502
+ elided_bonds_hint.append(
503
+ "Note: Bonds involving atoms that could not be assigned chemical "
504
+ + "information have been elided from this list."
505
+ )
506
+
507
+ if unassigned_bonds_with_assigned_atoms:
508
+ return [
509
+ (
510
+ f"Error: The following {len(unassigned_bonds_with_assigned_atoms)} "
511
+ + "bonds exist in the input but could not be assigned "
512
+ + "chemical information from the substructure library:"
513
+ ),
514
+ *(
515
+ f" Bond between atom {i_a: >5} ({self._atoms[i_a].name}) "
516
+ + f"in {self.residue_of_atom_as_str(i_a)} "
517
+ + f"and atom {i_b: >5} ({self._atoms[i_b].name}) "
518
+ + f"in {self.residue_of_atom_as_str(i_b)}"
519
+ for i_a, i_b in unassigned_bonds_with_assigned_atoms
520
+ ),
521
+ *elided_bonds_hint,
522
+ "",
523
+ ]
524
+ return []
525
+
526
+ def missing_hydrogens_hint(self) -> list[str]:
527
+ if self.omm_top and all(atom.element.symbol != "H" for atom in self._atoms):
528
+ return [
529
+ "Hint: There are no hydrogens in the input. The OpenFF Toolkit "
530
+ + "requires explicit hydrogens to avoid ambiguities in protonation "
531
+ + "state or bond order. Try generating hydrogens with another package "
532
+ + "and trying again.",
533
+ "",
534
+ ]
535
+ return []
536
+
537
+ def unknown_residue_hint(self) -> list[str]:
538
+ if self.substructure_library and self.omm_top:
539
+ unassigned_resnames = [self._atoms[i].residue.name for i in self.unassigned_atoms]
540
+ unknown_resnames = set(
541
+ [resname for resname in unassigned_resnames if resname not in self.substructure_library]
542
+ )
543
+ # Only raise this error if we're in Molecule.from_polymer_pdb,
544
+ # since Topology.from_pdb DOES accept multiple
545
+ # chains. We can tell the difference because
546
+ # Topology.from_pdb will have added the
547
+ # "UNIQUE_MOLECULE" key to the substructure library,
548
+ if ("HOH" in unknown_resnames) and ("UNIQUE_MOLECULE" not in self.substructure_library):
549
+ solvent_note = [
550
+ "Note: 'HOH' is a residue code for water. You may have "
551
+ + "crystallographic waters in your PDB file. Please remove "
552
+ + "these before proceeding, or use Topology.from_pdb."
553
+ ]
554
+ else:
555
+ solvent_note = [""]
556
+
557
+ if unknown_resnames:
558
+ return [
559
+ "Hint: The following residue names with unassigned atoms were not "
560
+ + "found in the substructure library. While the OpenFF Toolkit "
561
+ + "identifies residues by matching chemical substructures rather "
562
+ + "than by residue name, it currently only supports the 20 "
563
+ + "'canonical' amino acids.",
564
+ *(f" {resname}" for resname in sorted(unknown_resnames)),
565
+ *solvent_note,
566
+ "",
567
+ ]
568
+ return []
569
+
570
+ def multiple_chains_hint(self) -> list[str]:
571
+ # Only raise this error if we're in Molecule.from_polymer_pdb,
572
+ # since Topology.from_pdb DOES accept multiple
573
+ # chains. We can tell the difference because
574
+ # Topology.from_pdb will have added the
575
+ # "UNIQUE_MOLECULE" key to the substructure library,
576
+ if (self.omm_top.getNumChains() > 1) and ("UNIQUE_MOLECULE" not in self.substructure_library):
577
+ return [
578
+ "Hint: The input has multiple chain identifiers. The OpenFF "
579
+ + "Toolkit Molecule.from_polymer_pdb method only supports "
580
+ + "single-molecule PDB files. Please use Topology.from_pdb "
581
+ + "or split the file into individual chains and load each "
582
+ + "separately.",
583
+ "",
584
+ ]
585
+
586
+ return []
587
+
588
+ def assigned_residue_name_mismatch_hint(self) -> list[str]:
589
+ if not self.matches:
590
+ return []
591
+
592
+ # Construct a map from input residues to assigned resnames
593
+ residues: Mapping[tuple[str, str, str], set[str]] = defaultdict(set)
594
+ for atom in self.omm_top.atoms():
595
+ input_resname: str = atom.residue.name
596
+ input_resnum: str = atom.residue.id
597
+ input_chain: str = atom.residue.chain.id
598
+ matched_resnames = self.matches[atom.index]
599
+ # Only the first match is assigned, so throw out the others
600
+ assigned_resname = next(iter(matched_resnames), "No match").upper()
601
+
602
+ residues[(input_resname, input_resnum, input_chain)].add(assigned_resname)
603
+
604
+ # Filter out residues where assigned resname doesn't match the input
605
+ residues = {
606
+ (input_resname, input_resnum, input_chain): assigned_resnames
607
+ for (
608
+ input_resname,
609
+ input_resnum,
610
+ input_chain,
611
+ ), assigned_resnames in residues.items()
612
+ if set([input_resname]) != assigned_resnames
613
+ }
614
+
615
+ if residues:
616
+ return [
617
+ "Hint: The following residues were assigned names that do not "
618
+ + "match the residue name in the input, or could not be assigned "
619
+ + "residue names at all. This may indicate that atoms are "
620
+ + "missing from the input or some other error. The OpenFF "
621
+ + "Toolkit requires all atoms, including hydrogens, to be "
622
+ + "explicit in the input to avoid ambiguities in protonation "
623
+ + "state or bond order:",
624
+ *(
625
+ (
626
+ f" Input residue {self.fmt_residue(resname, int(resnum), chain)} "
627
+ + f"contains atoms matching substructures {assigned_resnames}"
628
+ )
629
+ for (
630
+ resname,
631
+ resnum,
632
+ chain,
633
+ ), assigned_resnames in residues.items()
634
+ ),
635
+ "",
636
+ ]
637
+
638
+ return []
639
+
640
+ def mismatched_atom_names_hint(self) -> list[str]:
641
+ from collections import defaultdict
642
+
643
+ if not (self.omm_top and self.substructure_library):
644
+ return []
645
+
646
+ # Collect all the unassigned atoms by residue
647
+ unassigned_residues: Mapping[OpenMMResidue, list[OpenMMAtom]] = defaultdict(list)
648
+ for i in self.unassigned_atoms:
649
+ atom = self._atoms[i]
650
+ res: OpenMMResidue = atom.residue
651
+ unassigned_residues[res].append(atom)
652
+
653
+ # Mark residues that don't have the right number and elements of atoms
654
+ # by clearing their atoms lists
655
+ for res, atoms in unassigned_residues.items():
656
+ try:
657
+ library_res = self.substructure_library[res.name]
658
+ except KeyError:
659
+ # Residue is not in substructure library at all!
660
+ atoms.clear()
661
+ continue
662
+ for library_elements, names in library_res:
663
+ residue_elements = sorted(atom.element.symbol for atom in res.atoms())
664
+ if library_elements == residue_elements:
665
+ # Prune the atoms down to just those whose names don't match
666
+ atoms[:] = [atom for atom in atoms if atom.name not in names]
667
+ # We're done with this residue
668
+ break
669
+ else:
670
+ # smiles for loop did not break, so clear the atom list
671
+ atoms.clear()
672
+ misnamed = {res: atoms for res, atoms in unassigned_residues.items() if atoms}
673
+
674
+ if misnamed:
675
+ return [
676
+ "Hint: The following residues have the right numbers of the "
677
+ + "right elements to match a substructure with the same name as "
678
+ + "the input residue, but did not match. This most likely "
679
+ + "suggests that their atom names do not match those in the "
680
+ + "substructure library. Try renaming misnamed atoms according "
681
+ + "to the PDB Chemical Component Dictionary.",
682
+ *(
683
+ (
684
+ f" Input residue {self.fmt_residue(res.name, int(res.id))} "
685
+ + f"has misnamed atoms {', '.join(a.name for a in atoms)}"
686
+ )
687
+ for res, atoms in misnamed.items()
688
+ ),
689
+ "",
690
+ ]
691
+
692
+ return []
693
+
694
+
695
+ class NonUniqueSubstructureName(OpenFFToolkitException):
696
+ """Exception raised when nonunique names are given"""
697
+
698
+ def __init__(self, duplicate_keys):
699
+ msg = "The following keys were found to be duplicate:"
700
+ for dkey in duplicate_keys:
701
+ msg += f"\n\t{dkey}"
702
+ msg += "\nDo not use standard residue names when naming custom substructures"
703
+ super().__init__(msg)
704
+ self.msg = msg
705
+
706
+
707
+ class SubstructureAtomSmartsInvalid(OpenFFToolkitException):
708
+ """Exception raised when atom or bond smarts are found to be improperly formatted"""
709
+
710
+ def __init__(self, name, atom_smarts, smarts, reason):
711
+ msg = f"Invalid atom smarts found in substructure smarts for {name}:\n"
712
+ msg += smarts + "\n" + " " * smarts.find(atom_smarts) + "^" * len(atom_smarts) + "\n"
713
+ msg += "REASON: " + reason
714
+ super().__init__(msg)
715
+ self.msg = msg
716
+
717
+
718
+ class SubstructureBondSmartsInvalid(OpenFFToolkitException):
719
+ def __init__(self, name, bond, valid_bond_types):
720
+ msg = f"Invalid bond smarts found in subsucture smarts for {name}:\n"
721
+ msg += f"SMARTS: {bond.GetSmarts()}\t" + f"BONDTYPE: {bond.GetBondType()}\n"
722
+ msg += "The only currently supported bond types are:\n"
723
+ for bond_type in valid_bond_types:
724
+ msg += f"\t{bond_type}\n"
725
+ super().__init__(msg)
726
+ self.msg = msg
727
+
728
+
729
+ class SubstructureImproperlySpecified(OpenFFToolkitException):
730
+ """Exception raised when substructure does not contain enough information"""
731
+
732
+ def __init__(self, name, reason):
733
+ msg = f"Improperly specified monomer for {name}:\n"
734
+ msg += f"\t{reason}"
735
+ super().__init__(msg)
736
+ self.msg = msg
737
+
738
+
739
+ class AmbiguousAtomChemicalAssignment(OpenFFToolkitException):
740
+ """Exception raised when substructure does not contain enough information"""
741
+
742
+ def __init__(self, res_name, mol_atom, query_atom, reason):
743
+ msg = (
744
+ f"Ambiguous chemical information assigned for residue {res_name} for molecule atom {mol_atom} and "
745
+ f"query atom {query_atom}:\n"
746
+ )
747
+ msg += f"\t{reason}"
748
+ super().__init__(msg)
749
+ self.msg = msg
750
+
751
+
752
+ class AmbiguousBondChemicalAssignment(OpenFFToolkitException):
753
+ """Exception raised when substructure does not contain enough information"""
754
+
755
+ def __init__(self, res_name, mol_bond, query_bond, reason):
756
+ msg = (
757
+ f"Ambiguous chemical information assigned for residue {res_name} for molecule bond {mol_bond} and "
758
+ f"query bond {query_bond}:\n"
759
+ )
760
+ msg += f"\t{reason}"
761
+ super().__init__(msg)
762
+ self.msg = msg
763
+
764
+
765
+ class BadMoleculeAssumptionError(OpenFFToolkitException):
766
+ """Exception raised when a molecule violates assumptions made by the OpenFF Toolkit's implementation"""