charnley / rmsd

Calculate Root-mean-square deviation (RMSD) of two molecules, using rotation, in xyz or pdb format
BSD 2-Clause "Simplified" License
495 stars 114 forks source link

Output rotation matrix #77

Closed Jellby closed 3 years ago

Jellby commented 3 years ago

Is there a flag that would output not (only) the minimized rmsd and the rotated B structure, but the rotation matrix (and translation vector) that needs to be applied? This would be useful when the same transformation has to be applied to other data, like multipole moments, surrounding molecules, etc.

Edit: I'm talking about the command-line script calculate_rmsd.

charnley commented 3 years ago

Hi @Jellby, the simplest solution would be to use the package as a Python module and get the translation and rotation as needed.

Why do you need it from the CLI? The output from calculate_rmsd is well established XYZ format, and adding to that will just make it very complicated to read.

Jellby commented 3 years ago

I "need" it for use in non-Python workflows (e.g. with a bash-only script, I'd probably output the matrix to a file and then use it downstream). Sometimes it's easier/faster just using the CLI and grep, than writing a Python script.

charnley commented 3 years ago

See https://github.com/charnley/rmsd/blob/master/example.py for example on how to calculate the translation and rotation. Should be straightforward to use and print out in the format you need. It will not be part of the stdout from the command-line tool.