• problems about install python-api-2.0 in centos7.5


    my env is Anaconda2 5.3.1 (python2.7.15)

    firstly, i installed CCDC2019

    when it finished, raise info:

    Info: The post-installation CSD Python API test did not return the expected
    output - this means that the installation may not have completed successfully.

    i checked install_log:

    Script stderr:
    Cannot use native OpenGL. Using Mesa.
    No OpenGL libraries found, using fallback MesaGL. This software requires OpenGL libraries for optimum performance and some features may not work correctly without them. We highly recommend installation

    and then install python-api, commands:

    conda install Pillow six lxml numpy matplotlib

    conda install csd-python-api-2.0.0-linux-64-py2.7-conda.tar.bz2

    but when I import ccdc:

    Python 2.7.15 |Anaconda, Inc.| (default, Dec 14 2018, 19:04:19)
    [GCC 7.3.0] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import ccdc
    QStandardPaths: wrong ownership on runtime directory /run/user/1000, 1000 instead of 0
    qt.qpa.screen: QXcbConnection: Could not connect to display
    python: relocation error: /PUBLIC/apps/anaconda2//lib/python2.7/site-packages/ccdc/_lib/libQt5XcbQpa.so.5: symbol _ZdlPvm, version Qt_5 not defined in file libQt5Core.so.5 with link time reference

    we must use a gui to import ccdc?


  • about Hbond search


            i was trying to search hbonds intermolecular in packing crystals. I use Molecule.HBondCriterion() to define hbonds.

            but the results are different with that shown in Mercury.

            for example:

            firstly, I define the HBondCriterion()

            def HBondCriterion():
                criterion = Molecule.HBondCriterion()
                criterion.distance_range = (-5.0, 0.0)
                criterion.intermolecular = 'intermolecular'
                criterion.angle_tolerance = 120.0
                criterion.donor_types['sp C'] = True
                criterion.donor_types['sp2 C'] = True
                criterion.donor_types['sp3 C'] = True
                criterion.donor_types['aromatic C'] = True
                criterion.donor_types['carboncationic C'] = True
                criterion.acceptor_types['unclassified F'] = True
                return criterion

    criterion = HBondCriterion()

    i searched hbond in ABABOW

    csd_reader = io.EntryReader('CSD')

    cry = csd_reader.crystal('ABABOW')


    the result is nothing; while I used cry.hbonds(hbond_criterion=criterion), the result is : 


    I used Mercury to show this packing crystal, and the setting about hbond is the same with pythonAPI. It displayed some Hbonds (see attachment).

    there are some thing different between pythonAPI and Mercury? why the result is nothing after packing?



  • about Halogen bond search

     I want to search some crystals that have intermolecular Halogen bond. I didnt find built-in approaches to search intermolecular Halogen bond in python API.

    So I used the following codes, but got noting:

    def Halogenbond():

        list_Halogenbond = []
        donor_element = ['C', 'c']
        x_element = ['Br', 'I']
        acceptor_element = ['H', 'N', 'O', 'F', 'S', 'Cl']
        VDW_radius = {'n':1.55, 'N':1.55, 'o':1.52, 'O':1.52, 's':1.80, 'S':1.80, 'Cl':1.75, 'Br':1.85,
                                  'I':1.98, 'C':1.70, 'H':1.09, 'F':1.47, 'c':1.70}

        for d in donor_element:

            for x in x_element:

                xd = x+d
                for a in acceptor_element:

                    bond_search = ccdc.search.SubstructureSearch()
                    donor_sub = ccdc.search.SMARTSSubstructure(xd)
                    acceptor_sub = ccdc.search.SMARTSSubstructure(a)
                    print(xd, a)
                    donor_sub_id = bond_search.add_substructure(donor_sub)
                    acceptor_sub_id = bond_search.add_substructure(acceptor_sub)
                                                                                  donor_sub_id, 0, 
                                                                                  acceptor_sub_id, 0,
                                                                                  (0.0, VDW_radius[d]+VDW_radius[x]+0.1), 

                                                                              donor_sub_id, 1,
                                                                              donor_sub_id, 0,
                                                                              acceptor_sub_id, 0,
                                                                              (120.0, 180.0))


        return list_Halogenbond

    For example, I search in ISIJEZ01:

    list_Halogenbond = Halogenbond()

    cry = csd_reader.crystal('ISIJEZ01')
    ent = csd_reader.entry('ISIJEZ01')
    mol = csd_reader.molecule('ISIJEZ01')

    l = []

    for i in list_Halogenbond:

        l.extend( i.search(mol))




    I have searched all crystals in CSD, but the result is nothing

    is something wrong with my approach for defining Halogen bond ?




  • RE: why the default h-bond distance range is negative (-5.0, 0.0)?

    Dear Richard,

    thanks for your help! I can confirm that the patch solves the problem.

  • RE: why the default h-bond distance range is negative (-5.0, 0.0)?

    Thanks for your detailed answer. But there is one more question that the hb.length is different when I use the two distance range (-5.0, 0.0) and (0.0, 5.0). For example:



    from ccdc import io
    csd = io.EntryReader('csd')
    cry = csd.crystal('TEHREG')

    def vdw_correct(hb):
    return hb.length - hb.atoms[0].vdw_radius - hb.atoms[-1].vdw_radius

    hbonds_vdw = cry.hbonds(distance_range=(-5, 0))
    for hb in hbonds_vdw:
    print(hb, hb.length, hb.atoms[0].vdw_radius, hb.atoms[-1].vdw_radius, vdw_correct(hb))

    HBond(Atom(O1)-Atom(H21)-Atom(N2)) 2.06647597521 1.52 1.55 -1.00352402479
    HBond(Atom(O2)-Atom(H22)-Atom(N4)) 2.13782138621 1.52 1.55 -0.932178613791 HBond(Atom(N1)-Atom(H1)-Atom(N3)) 2.21193130874 1.55 1.55 -0.888068691263

    hbonds_vdw = cry.hbonds(distance_range=(0, 5))
    for hb in hbonds_vdw:
    print(hb, hb.length, hb.atoms[0].vdw_radius, hb.atoms[-1].vdw_radius, vdw_correct(hb))

    HBond(Atom(O2)-Atom(H21)-Atom(N2)) 4.83753829295 1.52 1.55 1.76753829295 HBond(Atom(N1)-Atom(H1)-Atom(O3)) 5.41035345957 1.55 1.52 2.34035345957 HBond(Atom(N1)-Atom(H1)-Atom(O4)) 5.20008796325 1.55 1.52 2.13008796325 HBond(Atom(N1)-Atom(H1)-Atom(O4)) 7.67608495183 1.55 1.52 4.60608495183 HBond(Atom(O1)-Atom(H21)-Atom(N2)) 6.12238515037 1.52 1.55 3.05238515037 HBond(Atom(O2)-Atom(H21)-Atom(N2)) 5.56704927369 1.52 1.55 2.49704927369 HBond(Atom(N2)-Atom(H21)-Atom(N3)) 7.50483415478 1.55 1.55 4.40483415478 HBond(Atom(N2)-Atom(H21)-Atom(F4?)) 5.66590719935 1.55 1.47 2.64590719935 HBond(Atom(N2)-Atom(H21)-Atom(F6?)) 4.717808386 1.55 1.47 1.697808386


    the length of HBond(Atom(O1)-Atom(H21)-Atom(N2)) is different

    Why is this?the calculation criterion of H-bond found in google is that the distance between Acceptor and Donor is less or equal to a cutoff (i.e. 3.5Å or 5.0Å relaxed) and the angle D-H-A  is more or equal to 120°.   Is the calculation of the length of the hydrogen bond based on atomic coordinates? or other algorithm ?

    Best wishes

  • why the default h-bond distance range is negative (-5.0, 0.0)?

    why the default h-bond distance range is negative (-5.0, 0.0)?

    i got two different result ,when i use two different distance range (-5.0, 0.0) and (0.0, 5.0):


    cryst_mol = csd_reader.crystal('TEHREG')
    crystall_hbond = cryst_mol.hbonds(distance_range=(0.0, 5.0))

    crystall_hbond1 = cryst_mol.hbonds(distance_range=(-5.0, 0.0))
    (HBond(Atom(O1)-Atom(H21)-Atom(N2)), HBond(Atom(O2)-Atom(H22)-Atom(N4)), HBond(Atom(N1)-Atom(H1)-Atom(N3)))