HI Frank,
can you run mercury successfully? If so, the Help->About mercury should say where it found the licence. If the licence is in a non-standard place, i.e. not in CSD_2018/CSD_539/csd_licence.dat or /home/.../csd_licence.dat then you may need to set the environment variable CCDC_CSD_LICENCE_FILE to point to its location.
Let me know if this works.
Best wishes
Richard
Hi Frank,
I think you need to set the environment variable, CSDHOME so the API can find where the CSD is located:
export CSDHOME=/path/to/CCDC/CSD_2018
Try this, and see if that works, please.
Best wishes
Richard
Hi Frank,
yes, that should be the full path to the miniconda under your CSD installation. So on my network it was:
source CCDC_MAC/Python_API_2018/miniconda/bin/activate
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:
source deactivate
Best wishes
Richard
Hi Frank,
I've just done a clean install of the latest CSD system on a Mac, and installed jupyter on it with no problems:
source /path/to/miniconda/bin/activate
conda install jupyter
jupyter-console
In [1]: from ccdc import io
In [2]: csd = io.EntryReader('csd')
In [3]: len(csd)
Out[3]: 961466
So I'm really not sure what's happening when you try it. Is it possibly an instance of this issue?
https://downloads.ccdc.cam.ac.uk/documentation/API/trouble_shooting.html#un-installing-in-csds-conda-environment
If not, are there any other details you can give me, like how you installed jupyter, and what error messages you have seen?
Best wishes
Richard
Hi Frank,
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[0], b[1])
Mostly because I'm lazy.
Here is a good explanation of the basics behind *args, **kwargs:
https://thepythonguru.com/python-args-and-kwargs/
Best wishes
Richard
Hi Frank,
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')
m.assign_bond_types()
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:
m.add_bond('Aromatic', *b)
print m.smiles
[O][Ba]12([OH2])([OH2][Cu]3([OH2][Ba]4([O])([OH2])(oco4)O3C=O)(oco[Ba])(oco[Ba])O1C=O)oco2
I'm not perfectly convinced that the SMILES is legitimate, so I would be very wary of submitting it to other programs.
Best wishes
Richard
Hi Frank,
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:
/path/to/csd/miniconda/bin/jupyter-console
Best wishes
Richard
HI Frank,
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.
Best wishes
Richard
Good to hear. Let me know if any other problems crop up.
Best wishes
Richard
Hi Tahereh,
on a linux system you will need to set the environment variable CSDHOME to point to where you installed the CSD:
export CSDHOME=/..../CSD_2018
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
source /.../CSD_2018/Python_API_2018/miniconda/bin/activate
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.
Best wishes
Richard