I hope this script will be useful for posters and teaching materials. It uses a separate Python QR code generating package https://github.com/lincolnloop/python-qrcode that I installed easily using pip.

It's designed to be used via the Mercury scripts menu, and (hopefully!) for any CSD entry you are looking at will generate a QR code that links to the entry in the CCDC's Access Structures service, where anyone view and retrieve structures in the CSD.  From here you can download the original cif and see the compound name, 2D diagram, 3D structure etc. The QR code is displayed via a pop-up window, but also saved as a .png file in your specified output directory.

I'd be really interested to hear any comments or feedback!

For a bit more of an in-depth explanation:

To install the Python QR code generating package: Download the .zip file, from a command prompt (I'm using a Windows system here) type "pip install <location of the zip file you've just downloaded>". (Pip is installed automatically as part of recent Python versions). If this produces an error saying something like "'pip' is not recognized as an internal or external command" you need to modify the environment variable path to point to your Python scripts folder e.g. set PATH=%PATH%;C:\Python27;C:\Python27\Scripts

To make the script accessible from Mercury: The script should be saved into your scripts folder - for a typical Windows installation this will be C:\Program Files (x86)\CCDC\CSD_2016\mercury 3.8\scripts. The script name will then appear in the 'CSD Python API' menu of Mercury, and will generate the QR code for the structure currently in the visualiser.

I've had some feedback on the script, and following that I'm adding a revised version. The script works by using the CSD refcode for the structure currently viewed in Mercury to create a URL to the Access Structures page for that structure. Whilst this works well, the previous version of the script would create the URL for *any* structure viewed in Mercury, so could create QR codes with non-valid URLs. To try and fix this I've added a check in the script to make sure the identifier of the structure viewed in Mercury is 'CSD-like'. If the identifier doesn't look like a CSD refcode, the script will warn you accordingly!

You must be signed in to post in this forum.