• RE: BFDH Morphology

    Dear George, and Vijay,

    the latest version, 2.1.0 of the API has morphology calculation in the public API under the descriptors module.  There is documentation at https://downloads.ccdc.cam.ac.uk/documentation/API/descriptive_docs/descriptors.html#morphology and https://downloads.ccdc.cam.ac.uk/documentation/API/module/descriptors_api.html#ccdc.descriptors.CrystalDescriptors.Morphology

    Best wishes


  • RE: Co-crystal design

    Hi Luca,

    the return value of the screen() method is a ComplementarityScreen.ResultSet.  This has a couple of methods for extracting results grouped by active or by coformer, and list-like access to individual results, i.e.

    results = complementarity_screen.search(mol1, [mol2])

    result = results[0]

    Then you can get the individual success property:




    There is documentation for the ccdc_rp package available on the downloads page of the CCDC,


    under the CSD Python API Research Partner Add on documentation.

    I hope this is clear.  Get back to me if you would like more information.

    Best wishes


  • RE: Co-crystal design

    Dear Luca,

    this functionality has been exposed in the CSD Python API, but is currently available only to Research Partners of the CCDC. I believe you are working for Merck at the moment, and they are a Research Partner.  In which case you will be able to download the ccdc_rp package from the Research Partner Portal at CCDC, and gain access to it via

    from ccdc_rp.descriptors import MolecularDescriptors
    complementarity_screen = MolecularDescriptors.ComplementarityScreen()

    I hope this is helpful.  Please get back to me if anything is unclear.

    Best wishes


  • RE: How do I change the space group settings using python?


    I'm sorry, that functionality has not been exposed in the CSD python API.

    Best wishes


  • RE: How can I find polyoxometalates using the Python API?


    I think this is the sort of problem that is best addressed by scanning the CSD, rather than substructure searching it.  Something like the following would do what you want reasonable efficiently:

    import time
    from ccdc import io, search, utilities

    csd = io.EntryReader('csd')
    settings = search.Search.Settings()
    settings.must_have_elements = ['O', 'Mo']

    hits = []
    start = time.time()
    for i, e in enumerate(csd):
        if i and i % 10000 == 0:
            utilities.Timer.progress(start, i, len(csd), '%d hits' % len(hits))
        if settings.test(e):
            m = e.molecule
            if len([a for a in m.atoms if a.atomic_symbol == 'Mo']) > 6:

    with open('poms.gcd', 'w') as writer:

    If you have more complex requirements then maybe substructure searching may be necessary.  If the query returns a large number of hits, and you will be getting one for every Mo atom in the CSD, then an approach using a SubstructureSearch.HitProcessor would allow you to extract information from each hit as it is found, rather than waiting for the end of the search.

    I hope this is helpful.  Please come back to the forum if you have any further questions.

    Best wishes


  • RE: Systematically Measure Angles of Any Two Atoms Attached to a Metal

    I'm not quite clear what you are trying to do here.

    If you want to measure the metal's bond in a single molecule, then the following will work:

    from ccdc.descriptors import MolecularDescriptors

    def metal_angles(mol, element):
        metals = [a for a in mol.atoms if a.atomic_symbol == element]
        for m in metals:
            nbrs = m.neighbours
            for i in range(len(nbrs)):
                for j in range(i+1, len(nbrs)):
                    print('%s - %s - %s: %.3f' % (nbrs[i], m, nbrs[j], MolecularDescriptors.atom_angle(nbrs[i], m, nbrs[j])))

    We can test it with an entry from the CSD:

    from ccdc import io
    csd = io.EntryReader('csd')
    mol = csd.molecule('ABALUN')
    metal_angles(mol, 'Fe')

    You could use the search API to do the same thing:

    from ccdc import search
    searcher = search.SubstructureSearch()
    searcher.add_angle_measurement('ANG1', (0, 0), (0, 1), (0, 2))
    angles = searcher.search(mol)
    for a in angles:
        print a.match_atoms(), a.measurements['ANG1']

    The geometry analyser of the CSD does not analyse bond angles or torsion angles involving metal atoms.  This is because these measurements are sensitive to the oxidation state of the molecule.

    I hope this is helpful.

    Best wishes




  • RE: GoldMine functions using the CSD API

    Hi Jordan,

    I think the following will work:

    for i in range(len(results.ligands)):
            ligand = results.ligands[i]
        except RuntimeError:

    I'm curious as to why the docking results are corrupted, though.  Did you concatenate many files to make the docking result, or did GOLD create corrupted files?

    Best wishes

  • RE: Python: cannot access atom.occupancy/ General: what is atom.chirality = 'Mixed'?

    Hi Toms,

    can you let me know what the error message is when you try to access the occupancy attribute, and give me details of your Manjaro operating system?  I'd like to investigate this if I can find an appropriate vagrant virtualbox for it.



  • RE: GoldMine functions using the CSD API

    Dear Jordan,

    yes you will be able to use the API for this.

    The docking module of the CSD API, https://downloads.ccdc.cam.ac.uk/documentation/API/descriptive_docs/docking.html

    shows how to read ligands in their docked poses, how to get access to the scoring terms of the fitness function you have used, and how to inspect the hydrogen bonds of the docked poses.

    There are example programs using docking in https://downloads.ccdc.cam.ac.uk/documentation/API/cookbook_examples/docking_examples.html which may be helpful.

    Best wishes



  • RE: Python: cannot access atom.occupancy/ General: what is atom.chirality = 'Mixed'?

    Dear Toms,

    Can you show me an example script where atom.occupancy gives you an error?  The occupancy attribute may be None if the atom has no coordinates, that is for an implicit hydrogen.

    I can use it perfectly normally in, for example:

    from ccdc import io
    csd = io.EntryReader('csd')
    mol = csd.molecule('ABABUB')
    print('\n'.join('%s: %.4f' % (a, a.occupancy) for a in mol.atoms))

    The value 'Mixed' is returned when the algorithm used to determine chirality is unable to come up with an answer.  This can occur when the chiral atom has more than four bonds, for example, atom U1 of AAPUNI.

    Best wishes