Skip to content

Instantly share code, notes, and snippets.

@iwatobipen
Created May 14, 2019 06:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iwatobipen/520515f0d0050eff28cd97d031c44ec2 to your computer and use it in GitHub Desktop.
Save iwatobipen/520515f0d0050eff28cd97d031c44ec2 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
"import os"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"sys.path.append('/Users/iwatobipen/develop/chemoenv/psikit/psikit')"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"from psikit import Psikit\n",
"import psi4"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"pk = Psikit()"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"pk.read_from_smiles('c1cccnc1')\n",
"st = ''\n",
"for i in range(pk.mol.GetNumAtoms()):\n",
" st += str(i)+\" xyz\\n\""
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"pk.psi4.set_options({'OPT_COORDINATES':'CARTESIAN','FROZEN_CARTESIAN':st})"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"-246.69632927796312"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pk.energy()"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"c1=pk.mol.GetConformer()"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"-1.1798080162788467 0.5395628155681792 -0.040898689809211915\n",
"0.06518501702779525 1.1725200495297896 -0.024197196431391794\n",
"1.2324170131466978 0.40674272533062134 0.02136959764386789\n",
"1.1341947566448707 -0.9870796028842717 0.049623787535432146\n",
"-0.08808077531813244 -1.5843578108096479 0.032696378317569226\n",
"-1.2366886542335542 -0.8565357626249066 -0.011577101627813696\n",
"-2.090258996636217 1.123713375541261 -0.07615152943552474\n",
"0.12525020620869629 2.2529526429691744 -0.04649351917653518\n",
"2.2020635800742587 0.8873725333088379 0.03464869040642951\n",
"2.029210551536477 -1.5936990336790273 0.08499205976623224\n",
"-2.193484682172043 -1.3611919322500243 -0.02401247718906001\n"
]
}
],
"source": [
"for i in range(pk.mol.GetNumAtoms()):\n",
" pos = c1.GetAtomPosition(i)\n",
" print(pos.x, pos.y, pos.z)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
"from rdkit import Chem"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
" RDKit 3D\n",
"\n",
" 11 11 0 0 0 0 0 0 0 0999 V2000\n",
" -1.1798 0.5396 -0.0409 C 0 0 0 0 0 0 0 0 0 0 0 0\n",
" 0.0652 1.1725 -0.0242 C 0 0 0 0 0 0 0 0 0 0 0 0\n",
" 1.2324 0.4067 0.0214 C 0 0 0 0 0 0 0 0 0 0 0 0\n",
" 1.1342 -0.9871 0.0496 C 0 0 0 0 0 0 0 0 0 0 0 0\n",
" -0.0881 -1.5844 0.0327 N 0 0 0 0 0 0 0 0 0 0 0 0\n",
" -1.2367 -0.8565 -0.0116 C 0 0 0 0 0 0 0 0 0 0 0 0\n",
" -2.0903 1.1237 -0.0762 H 0 0 0 0 0 0 0 0 0 0 0 0\n",
" 0.1253 2.2530 -0.0465 H 0 0 0 0 0 0 0 0 0 0 0 0\n",
" 2.2021 0.8874 0.0346 H 0 0 0 0 0 0 0 0 0 0 0 0\n",
" 2.0292 -1.5937 0.0850 H 0 0 0 0 0 0 0 0 0 0 0 0\n",
" -2.1935 -1.3612 -0.0240 H 0 0 0 0 0 0 0 0 0 0 0 0\n",
" 1 2 2 0\n",
" 2 3 1 0\n",
" 3 4 2 0\n",
" 4 5 1 0\n",
" 5 6 2 0\n",
" 6 1 1 0\n",
" 1 7 1 0\n",
" 2 8 1 0\n",
" 3 9 1 0\n",
" 4 10 1 0\n",
" 6 11 1 0\n",
"M END\n",
"\n"
]
}
],
"source": [
"print(Chem.MolToMolBlock(pk.mol))"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
"pmol=pk.wfn.molecule()"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"11\n",
"C5H5N\n",
"C -1.167454487914 0.761772792678 -0.045484422418\n",
"C 0.077538545393 1.394730026640 -0.028782929041\n",
"C 1.244770541512 0.628952702440 0.016783865035\n",
"C 1.146548285010 -0.764869625775 0.045038054926\n",
"N -0.075727246953 -1.362147833700 0.028110645708\n",
"C -1.224335125868 -0.634325785515 -0.016162834237\n",
"H -2.077905468271 1.345923352651 -0.080737262045\n",
"H 0.137603734574 2.475162620079 -0.051079251786\n",
"H 2.214417108440 1.109582510419 0.030062957797\n",
"H 2.041564079902 -1.371489056569 0.080406327157\n",
"H -2.181131153807 -1.138981955140 -0.028598209798\n",
"\n"
]
}
],
"source": [
"print(pmol.to_string(dtype='xyz', units='angstrom'))"
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {},
"outputs": [],
"source": [
"pmol.set_units(pk.psi4.core.GeometryUnits.Angstrom)"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"11\n",
"C5H5N\n",
"C 0.558467286814 0.479369884597 0.055344583255\n",
"C -0.136879701051 0.726450872880 0.013424718307\n",
"C -0.694954000527 0.244995215113 -0.041958039092\n",
"C -0.547310800252 -0.479567223669 -0.054552008614\n",
"N 0.133682069403 -0.709480311343 -0.013111328786\n",
"C 0.684628756033 -0.249209468187 0.041084281858\n",
"H 0.994678796710 0.848003953147 0.098387304731\n",
"H -0.242913973601 1.289198698848 0.023823000261\n",
"H -1.235663909075 0.430956429182 -0.074751909041\n",
"H -0.973891994820 -0.858935524734 -0.097249249706\n",
"H 1.220271277774 -0.448653621219 0.073085054591\n",
"\n"
]
}
],
"source": [
"print(pmol.to_string(dtype='xyz'))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.6.8"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
@iwatobipen
Copy link
Author

psi4 coordination check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment