charnley / rmsd

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

saving rotated coordinate? #79

Closed vaibhavadixit closed 3 years ago

vaibhavadixit commented 3 years ago

Hi, I came to know about this tool from openbabel github page. I'm interested in translating and then rotating a pdb structure such that a specified atom (X) is at the center and X-Y bond is aligned in the -z direction.

Thus I"m just curious is it possible to save rotated structures in addition to printing rmsd with this "rmsd" program. Looking forward to valuable suggestions. thank you and best regards, Vaibhav

nbehrnd commented 3 years ago

Thus I"m just curious is it possible to save rotated structures in addition to printing rmsd with this "rmsd" program.

To report the position of structure test2.xyz aligned (as entity) to structure test1.xyz, the first of the two following will report to the command line, the second write a permanent record:

python3 calculate_rmsd.py test1.xyz test2.xyz -p
python3 calculate_rmsd.py test1.xyz test2.xyz -p > aligned.xyz

The first part of the answer might be possible (cf. with

python3 calculate_rmsd.py -h

for the options of the program available) via optional explicit lists of atoms to include/exclude in the Kabsch test, perhaps an other user/contributor may share experience. (Vaguely I recall pymol has an option/command for the alignment of proteins with a reference sequence of amino acids in common, which possibly is an overkill here.)

charnley commented 3 years ago

I'm interested in translating and then rotating a pdb structure such that a specified atom (X) is at the center and X-Y bond is aligned in the -z direction.

For advanced rotations and translation like this I recommend using this project as a Python lib. See example.py to get started.

save rotated structures in addition to printing rmsd with this "rmsd" program. Looking forward to valuable suggestions.

As shown in the commands above, the flag you are looking for is -p for print. See calculate_rmsd -h for documentation.