Dear all,

I am trying to use the Python API for my research, and I need to invert molecules, as it can be done in Mercury by Edit-Transform-Inversion & Translation-Invert (-x,-y,-z).

On the user guide of the Python API though I could only find commands to rotate or translate a given molecule, but not to invert it. So I was wondering whether there is any way to actually invert a molecule using the API.



If you are dealing with a molecule from a crystal structure then you can invert molecules in it using the symmetric_molecule method (API reference). Here is an example:

inverted_mol = my_crystal.symmetric_molecule('-x,-y,-z', (0, 0, 0), force=True)

By default the method only allows you to apply operations compatible with that crystal's space-group symmetry (as in the GUI tool) but you can force inversion with the force=True option.

If you only have a molecule, with no crystal information, this method can't be used. However, if comparing molecules using the overlay method you can allow for inversion. Alternatively, you can create an empty default crystal and put the molecule into it and then apply the operations as above.

Thanks Anthony, I think the first method seems like a suitable option! 



You must be signed in to post in this forum.