Created
February 13, 2023 19:35
-
-
Save goraj/63c1ca4f179f63645a2edb51fb4164be to your computer and use it in GitHub Desktop.
Attempt to recreate Hammet constants from Peter Ertl's paper: https://chemistry-europe.onlinelibrary.wiley.com/doi/pdf/10.1002/cmtd.202200041
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"id": "f99032df-1cc9-4440-9536-35063dd717be", | |
"metadata": {}, | |
"source": [ | |
"Attempt to recreate Hammet constants from Peter Ertl's paper: https://chemistry-europe.onlinelibrary.wiley.com/doi/pdf/10.1002/cmtd.202200041" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 177, | |
"id": "4d47869b-442f-4904-aa97-00827a9170f8", | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [], | |
"source": [ | |
"from xtb.libxtb import VERBOSITY_MINIMAL, VERBOSITY_MUTED\n", | |
"from xtb.interface import Calculator, Param\n", | |
"import numpy as np\n", | |
"\n", | |
"from rdkit import Chem\n", | |
"from rdkit.Chem import AllChem\n", | |
"from rdkit.Chem import rdDistGeom\n", | |
"\n", | |
"mol = Chem.MolFromSmiles(\"c1ccccc1(C)\")\n", | |
"mol = Chem.AddHs(mol, addCoords=True)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 178, | |
"id": "dfcd852f-900c-4a95-9826-dd71571165f6", | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [], | |
"source": [ | |
"for i, atom in enumerate(mol.GetAtoms()):\n", | |
" atom.SetProp(\"atomLabel\", f\"{i}\")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 179, | |
"id": "9a210dbd-3685-4f91-8aa4-5d10c8876d22", | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAcIAAACWCAIAAAD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VAaP/lRXV7PZbDqd3rt3b6kWqqioqK2tbT3Sq1ev0tJS4mm51gwMDL7df8dvHbRRxZWXl+fn52dubr5r1y7cWb7SjBkzEEKbNm3S19eXZd2srKxjx445ODhMnz5dlnWBfIJbTIpLSUkpKytr79692dnZuLN8jZs3bx47duzMmTMSfDjsM+Xm5sbFxV2+fFnGdYF8gjaquPr06ePv708sdP/NnZSIYy9btszExAR3HKDQoI0qtFWrVunp6f3111/E84/fkH379t25c8fQ0BB2WgbYQRtVaJqamqtXr0YIhYSEfHjXQm7V1dWFh4cjhKKjo4nnHADACNqoops/f76Njc2rV682bdqEO8vnWrNmTUlJybBhw+AOD5AH0EYVHZlMjouLI5FI69evLywsxB3n054/f/7777+LY+OOAwC0UYCQo6PjtGnTxPvZyTliVztvb29bW1vcWQBACNooIGzatEldXf3IkSMZGRm4s3zM1atXz58/r6GhsWbNGtxZAHgL2ihACCEjI6Pg4GCRSMRkMiW4YrRk8fl8JpOJEAoPD5fx8/YAfAS0UfBWaGiosbHxvXv3EhMTcWdp39atW3Nzc3v37r148WLcWQB4B9ooeEtNTe23335DCIWGhrZ5j1seVFVVrV27FiG0efNmFRUV3HEAeAfaKHhnxowZTk5OpaWl69evx52lrZUrV1ZWVo4ePXrixIm4swDwHmij4B0SiRQfH08mk2NjY58+fYo7zjuPHz/evXs3lUqNi4vDnQWAtqCNgvcMGTLkp59+4vF4S5cuxZ3lncDAQD6f7+/v379/f9xZAGgL2ihoa8OGDZqammfOnLl06RLuLAghdPr06StXrmhra//666+4swDQDmijoC1dXd3Q0FCEUFBQUEtLC94wPB5v+fLlCKG1a9d2794dbxgA2gVtFLQjKCiob9++T548wb6ic0xMzNOnT/v16/fhdhoAyAnYpx60Q1lZOSoqavLkyefOnfP39//wB2pqaiT7lH63bt3I5HZ+qaempiKEEhISiM1CAJBD8F8TtG/SpEnnz593d3dv97v9+/cvKiqSYLmcnJx2bx9duXIlNTV19OjREqwFgGRBGwX/aPz48cQXDx8+jIuLI5PJe/f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tlXN7m9RUoyUDpe/a8LtfNQjACOkzsEOFEzueMoRdTafqpZ5DP4zEZhPTOf5vv5z/AuHNZ8ZjsJStcW7j+Zj1VIncMeheOwR4ejUfvUu6xa38BM4P66BpJKGhw3aE+RDunNZ/e3rMGBgbDfySiyKRqRC79SSZLVsDLPO1q71aNwzJPWo2Rp9eaizyDFlaUqeUjPWmR8AZarQXi2WnGo5g0r8S91+xxVMgmRcSRyGaiXI2M4MTRyBthiYNQMPoVQzQyFUOyctjHy377jXndfAGz+MLkLeDLOgAAAMh6VFh0U01JTEVTIHJka2l0IDIwMjIuMDkuNAAAeJxdjbEOgzAMRH+lAwNIiWU7SZvgsQvduiOGigmpqKhl5OMLoaWki8/vTj7XVdNSm9dVU3znOWocO5vmeZhybeCkUIlm4KgE1ikCDgHtx2ZwwaNXgoC7DMHvI7+cM5hFzI/mQrducYkVOunQW8n6XKfft7hQWRAWI4RihUicHIVYaHasoJyExGfqNj766/MxlAjd69IP967tRqDSpOhS9CmGFOmvi/iPbcLTG2sfY8aCXFp4AAAAAElFTkSuQmCC\n", | |
"text/plain": [ | |
"<rdkit.Chem.rdchem.Mol at 0x12f5b4ac0>" | |
] | |
}, | |
"execution_count": 179, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"mol" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "5177659b-adc2-414b-9862-8284d905b9cb", | |
"metadata": {}, | |
"source": [ | |
"Atom positions that map to Peter's ring positions." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 180, | |
"id": "8af05ab7-9144-4d1e-87b1-4d3728bf4ad8", | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [], | |
"source": [ | |
"class ChargeMap:\n", | |
" ATTACHMENT = 5\n", | |
" ORTHO = 0\n", | |
" META = 1\n", | |
" PARA = 2" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 181, | |
"id": "07329c7f-cab8-4fbe-a9b2-597cf62b30a6", | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [], | |
"source": [ | |
"def atoms_and_pos_from_rdkit_mol(mol: Chem.Mol):\n", | |
" atoms = np.zeros(mol.GetNumAtoms())\n", | |
" pos = np.zeros((mol.GetNumAtoms(), 3))\n", | |
" \n", | |
" for i, atom in enumerate(mol.GetAtoms()):\n", | |
" positions = mol.GetConformer().GetAtomPosition(i)\n", | |
" atoms[i] = atom.GetAtomicNum()\n", | |
" pos[i] = (positions.x, positions.y, positions.z)\n", | |
" return atoms, pos\n", | |
"\n", | |
"def calculate_conformers(mol: Chem.Mol):\n", | |
" etkdg = rdDistGeom.ETKDGv3()\n", | |
" etkdg.randomSeed = 42\n", | |
" etkdg.verbose = False\n", | |
" etkdg.numThreads = 8\n", | |
" etkdg.useRandomCoords = True\n", | |
"\n", | |
" num_conformers = 100\n", | |
"\n", | |
" Chem.AssignStereochemistryFrom3D(mol)\n", | |
" conformation_ids = rdDistGeom.EmbedMultipleConfs(mol, numConfs=num_conformers, params=etkdg)\n", | |
" \n", | |
" return mol\n", | |
"\n", | |
"def calculate_charges(param, mol: Chem.Mol):\n", | |
" mol = calculate_conformers(mol)\n", | |
" \n", | |
" atoms, pos = atoms_and_pos_from_rdkit_mol(mol)\n", | |
" calc = Calculator(param, atoms, pos)\n", | |
" calc.set_verbosity(VERBOSITY_MUTED)\n", | |
" res = calc.singlepoint()\n", | |
" partial_charges = res.get_charges()\n", | |
" \n", | |
" \n", | |
" return partial_charges" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 197, | |
"id": "d40a729e-51d9-4695-88d9-1ea321cef9db", | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [], | |
"source": [ | |
"def hammet_constants_func(q_attachment: float, q_ortho: float, q_meta: float, q_para: float):\n", | |
" sigma_meta = 1.9381 + 0.9273 * q_attachment + 43.9107 * q_meta + 8.6774 * q_para \n", | |
" sigma_para = 2.0849 + 0.2074 * q_attachment + 28.4679 * q_meta + 28.9006 * q_para\n", | |
" \n", | |
" \n", | |
" return sigma_meta, sigma_para\n", | |
"\n", | |
"def calculate_hammet_constants(param, mol: Chem.Mol):\n", | |
" partial_charges = calculate_charges(param, mol)\n", | |
" \n", | |
" q_attachment=partial_charges[ChargeMap.ATTACHMENT]\n", | |
" q_ortho=partial_charges[ChargeMap.ORTHO]\n", | |
" q_meta=partial_charges[ChargeMap.META]\n", | |
" q_para=partial_charges[ChargeMap.PARA]\n", | |
" \n", | |
" print(f\"Charges:\\n{q_attachment = :.3f}\\n{q_ortho = :.3f}\\n{q_meta = :.3f}\\n{q_para = :.3f}\")\n", | |
" sigma_meta, sigma_para = hammet_constants(\n", | |
" q_attachment=q_attachment, \n", | |
" q_ortho=q_ortho,\n", | |
" q_meta=q_meta,\n", | |
" q_para=q_para\n", | |
" )\n", | |
" return (sigma_meta, sigma_para)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 198, | |
"id": "25b6e3f0-8980-4f0a-919b-d396712cd13e", | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Charges:\n", | |
"q_attachment = 0.386\n", | |
"q_ortho = 0.212\n", | |
"q_meta = 0.209\n", | |
"q_para = 0.071\n", | |
"GFN1xTB: (12.07879763040109, 10.154674008151897)\n" | |
] | |
} | |
], | |
"source": [ | |
"print(f\"GFN1xTB: {calculate_hammet_constants(Param.GFN1xTB, mol)}\")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 199, | |
"id": "5bdfb6f3-84e1-44ed-864b-0aca08edea41", | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Charges:\n", | |
"q_attachment = 0.240\n", | |
"q_ortho = -0.153\n", | |
"q_meta = -0.060\n", | |
"q_para = -0.146\n", | |
"GFN2xTB: (-1.7473574765373785, -3.8024574359170535)\n" | |
] | |
} | |
], | |
"source": [ | |
"print(f\"GFN2xTB: {calculate_hammet_constants(Param.GFN2xTB, mol)}\")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"id": "c340b834-6fd9-444d-90a9-d0044ab77ca9", | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3 (ipykernel)", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.11.0" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 5 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment