• RE: Querying the CSD by substructure created "from scratch"

    Many thanks, Richard -- for my purposes I'm not too worried about a few missing structures, so I shall continue using the API for this. Great work, by the way!

    Cheers,

    Christian

  • Querying the CSD by substructure created "from scratch"

    I'm trying to search for molecules containing a Cu bonded to 6 O atoms. When I build this structure in ConQuest and search CSD v5.36 and CSD v5.36 updates, 3D coordinates determined, Not disordered, No errors, I get 630 hits. But when I try to build the same query using the API I get only 355 hits. Am I going about this the right way?

    from __future__ import print_function
    from datetime import datetime
    import numpy as np
    import ccdc
    import os
    import glob

    csd_dir = ccdc.io.csd_directory()
    csd_and_updates = glob.glob(os.path.join(csd_dir, '*.inf'))
    csd_and_updates_reader = ccdc.io.EntryReader(csd_and_updates)

    cuo6 = ccdc.search.QuerySubstructure()
    cu = cuo6.add_atom('Cu')
    o, b = [], []
    for i in range(6):
        o.append(cuo6.add_atom('O'))
        b.append(cuo6.add_bond('Single', cu, o[-1]))
    substructure_search = ccdc.search.SubstructureSearch()
    sub_id = substructure_search.add_substructure(cuo6)

    substructure_search.settings.has_3d_coordinates = True
    substructure_search.settings.no_disorder = True
    substructure_search.settings.no_errors = True
    #substructure_search.settings.max_r_factor = 0.05

    start = datetime.now()
    hits = substructure_search.search(csd_and_updates_reader, max_hits_per_structure=1)
    end = datetime.now()

    for hit in hits:
        print(hit.identifier)

    print('{} hits in {:.1f} secs'.format(len(hits), (end-start).total_seconds()))

    Why is my program not picking up, e.g. ABUXAW? I also don't understand why, when I set the Maximum r-factor to 0.05 I get 388 hits from ConQuest but none at all from the API.

     

  • RE: Installion woes: CSD Python API 0.7.0 on a Mac

    Thanks, Dave-- I see what went wrong with this now and I have the API working with my system Python. Perhaps a comment in the Mac documentation about this path would help other Mac users?
    Best wishes,

    Christian

  • RE: Installion woes: CSD Python API 0.7.0 on a Mac

    Hi Stewart,

    Thanks for your reply - I'll try to make my installation using the system Python work, then. I think I have CSDS installed correctly (I can use ConQuest and Mercury and so on): it seems to have placed its files in /Applications/CCDC/CSD_System_2015/ so accordingly I set $CSDHOME to /Applications/CCDC/CSD_System_2015/DATA/CSD_536/

    Do I have the correct version of CSDS installed?
    Christian

  • Installion woes: CSD Python API 0.7.0 on a Mac

    I've been having trouble installing the Python API on my Mac. I first tried inside an Anaconda environment.

    The initial problem seems to be related to this bug in Anaconda: https://github.com/conda/conda/issues/721 and can be circumvented by installing lxml with `conda` before attempting to install the API software. Then, installing with:

    pip install csd-python-api-0.7.0-linux-py2.7.tar.gz

    compiles and installs the files but seems to link them against the wrong libraries somewhere (presumably the system python and not my Anaconda python) because when I run the tests I get:

    Fatal Python error: PyThreadState_Get: no current thread
    Abort trap: 6 with Python 2.7.5

    I can get an installation using the system Python (though not from within a virtualenv) which runs the tests, but these then fail in various ways, either by skipping the tests or with the curious error:

    RuntimeError: Welcome to the CSD Python API. Access is available to all organisations and institutions.
    To find details for your company or university please contact admin@ccdc.cam.ac.uk.

     

    I'm following the instructions at https://downloads.ccdc.cam.ac.uk/documentation/API/installation_notes.html

    Has anyone managed to get the API installed on a Mac, preferably inside a virtualenv and preferably within Anaconda?

    Thanks,

    Christian