• RE: converting a directory of mol2 files to cif files

    Hi Koen,

    Give this script a try from the command line. You can give it either a folder of .mol2 files or a single .mol2 file, and it will convert the files into .cif format. If you're having trouble getting the correct folder, type the full path into the command line.

     

    for example:

    python mol2_to_cif.py C:\andy\my_mol2s

    would convert all of the .mol2 files in the folder "my_mol2s" to .cif files.

     

    If you want to delete the .mol2 files as you go, you can uncomment the two lines that read # os.remove(m) (you do this by deleting the "# " at the start). 

     

    Please let me know how you get on.

    Cheers,

    Andy

  • RE: Welcome to this forum. Please introduce yourself.

    Hello,

    I'm Andy, and I also work at the CCDC, where I am a postdoc in the Materials Sciences team. My background is in chemical crystallography, with a focus on intermolecular interaction energies. Now, for the most part, I get to do interesting research to try to make the tools available for structural analysis even better.

    I'm excited about the CSD Python API because it's allowing me to effectively combine all sorts of different functionalities in really powerful ways, and I'm looking forward to seeing how the knowledge of everyone using our API can be combined to tackle all sorts of problems.

  • Script to generate diagrams for all molecules in a structure file

    This script will generate a 2D image of the chemical diagram for the contents of a supported structure file (e.g. a .cif or a .mol2). The image will be saved as a PNG in the workind directory. An image will be generated for everything in the structure file, i.e. if there are 3 structures in your .cif, you will get three diagrams generated.

    Run the script from the command line, for instance:

    python diagram_to_file.py crystal.cif

    will generate diagrams for whatever is contained in "crystal.cif".

    The functions in this script could also easily be used as part of a larger script to generate tailored reports using the CSD Python API.

  • RE: Python for beginners

    I used Codecademy to teach myself. There's a free online course there which takes about twelve hours (or so) to go through. It was nice and easy and went through things in a good level of detail.

  • What code editors do you use for writing Python scripts?

    I've been using PyCharm, but I was curious to know what everyone else uses, and if anyone thinks any editors are better for specific jobs?