Hello:
I have successfully tried the psithon examples from the website. So, my python installation, the psi4 installation is working.
My plan is to use rdkit and psi4 in the same script.
Assume I am reading with rdkit a molecule. Next I am extracting the x,y,z coordinates of the atoms and create a triple quoted variable. This variable I would like to use in psithon.
Here is my simple script:
Blockquote
import os, sys
import psi4
from rdkit import Chem
Blockquote
mol = Chem.MolFromMol2File(β./MAP.mol2β,removeHs=False)
Blockquote
xyz = β"""β + β\nβ
xyz += β0 1 " + β\nβ
for counter in range(mol.GetNumAtoms()):
pos = mol.GetConformer().GetAtomPosition(counter)
xyz += str((β%s %12.8f %12.8f %12.8f\n" % (β β + mol.GetAtomWithIdx(counter).GetSymbol(), pos.x, pos.y, pos.z)))
xyz += β"""β
Blockquote
print(xyz)
psi4mol = psi4.geometry(xyz)
psi4mol.update_geometry()
But this fails with an error message:
Blockquote
Traceback (most recent call last):
File β./test_my1.pyβ, line 17, in
psi4mol = psi4.geometry(xyz)
File β/home/mmetz/anaconda3/envs/my-rdkit-env/lib/python3.6/site-packages/psi4/driver/molutil.pyβ, line 305, in geometry
molecule = core.Molecule.create_molecule_from_string(geom)
RuntimeError:
Fatal Error: Illegal atom symbol in geometry specification: ββ" on line
ββ"
Error occurred in file: /scratch/psilocaluser/conda-builds/psi4-multiout_1532493090788/work/psi4/src/psi4/libmints/molecule.cc on line: 1205
The most recent 5 function calls were:
Blockquote
psi::Molecule::create_molecule_from_string(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)
I have tried to create the triple quoted variable in different ways such as using ββ""" but this did not work.
What worked is if I create the molecule in the same way as in the examples:
q4mol = ps4.geometry(""" β¦ ββ")
So, to be clear, I am having problems creating the triple quoted variable in the fly.
Not sure what I am missing.
Best regards,
Markus