I think you need to set the environment variable, CSDHOME so the API can find where the CSD is located:
Try this, and see if that works, please.
yes, that should be the full path to the miniconda under your CSD installation. So on my network it was:
This sets your path to include the miniconda bin directory at the front, so things like python and conda will be those in that directory. You can call these directly from this bin directory without activating the miniconda, but it's usually easier to activate and make sure that you are using a consistent set of programs.
You can deactivate, i.e. return to your normal path settings by:
I've just done a clean install of the latest CSD system on a Mac, and installed jupyter on it with no problems:
conda install jupyter
In : from ccdc import io
In : csd = io.EntryReader('csd')
In : len(csd)
So I'm really not sure what's happening when you try it. Is it possibly an instance of this issue?
If not, are there any other details you can give me, like how you installed jupyter, and what error messages you have seen?
putting the * before an argument essentially says 'treat the expression after the * as the remaining positional arguments to the function'. Here I used it as a shorthand for:
m.add_bond('Aromatic', b, b)
Mostly because I'm lazy.
Here is a good explanation of the basics behind *args, **kwargs:
the problem is with the delocalised bonds in these structures, and we do not have any method in the API to replace them.
You can get a SMILES representation of the molecule by replacing the delocalised bonds with aromatic bonds:
from ccdc import io, utilities
csd = io.EntryReader('csd')
m = csd.molecule('ABACUF')
deloc = [b.atoms for b in m.bonds if b.bond_type == 'Delocalised']
m.remove_bonds(b for b in m.bonds if b.bond_type == 'Delocalised')
for b in deloc:
I'm not perfectly convinced that the SMILES is legitimate, so I would be very wary of submitting it to other programs.
it should be possible to install Jupyter notebook into the CSD's miniconda:
/path/to/csd/miniconda/bin/conda install jupyter
then you can run:
can you give me a REFCODE where the SMILES fails? In general the smiles property of a molecule will return None if there are unknown atoms or unknown bonds in the structure.
Good to hear. Let me know if any other problems crop up.
on a linux system you will need to set the environment variable CSDHOME to point to where you installed the CSD:
which will enable the API to find the CSD and other files in your installation.
Sorry about the mistake in the second form. It should read
which will set the default python, here called 'base'. This should appear at the start of your prompt string as (base) followed by the rest of the prompt string.
you can run the script directly by:
/.../Python API/miniconda/bin/python2 script.py
or you can activate the python:
I hope this is helpful. If not, please get back to me.