# # This script can be used for any purpose without limitation subject to the # conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx # # This permission notice and the following statement of attribution must be # included in all copies or substantial portions of this script. # # 2015-06-15: created by A. G. P. Maloney, the Cambridge Crystallographic Data Centre # 2015-06-18: made available by the Cambridge Crystallographic Data Centre# # """ An introductory script to explain features of the MercuryInterface utility """ # Comments are preceded by a hash -> # # This next statement will let us find out where this script is located later on import os # First we need to import the MercuryInterface utility: from mercury_interface import MercuryInterface # Then we create a MercuryInterface instance, storing it in a variable called 'helper': helper = MercuryInterface() # We can then use the MercuryInterface to obtain the current entry shown in the Mercury Visualiser: entry = helper.current_entry # We can use the MercuryInterface to find the locations to use for various output files, for example a .html file: html_file = helper.output_html_file # Using similar notation, we can output .csv files, .tsv files, .c2m files and .gcd files # We can also use the helper to get the CCDC logo! logo = helper.get_ccdc_logo # The following code will print the CCDC logo and write the identifier of the current entry to the .html file. # It will also give the location of this html file, as well as the location of this script so you can find it again! f = open(html_file, "w") f.write('') f.write('
You are seeing this because you ran welcome.py from Mercury's CSD Python API Menu. Good job!") f.write('