charnley / rmsd

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

partially defunct structure export. #46

Closed nbehrnd closed 5 years ago

nbehrnd commented 5 years ago

calculate_rmsd.py permits loading of structural models, their superposition, determination of the RMSD and optional export of the second structure -- then aligned to the first one in the .xyz format. As I notice, this structure export is affected badly already in the master branch version 1.3.0 (which, to ascertain the situation, was freshly checked-out by mine today); yet equally the pull request by xg590. It is observed regardless if .pdb, or *.xyz data provide the model data to scrutinize once the optional --p parameter is used while simultaneously requesting either --use-reflections, or --use-reflections-keep-stereo.

I became aware of this issue while cross-checking with *.xyz model data derived from crystallographic models about tartaric acid. Initially, I aimed to check xg590's pull request, the option --use-reflections may invert the sterochemical information, which xg590's extension --use-reflection-keep-stereo aims to rectify. The test data for this query are derived from crystallographic models by the Cambridge Crystallographic Database about tartaric acid intentionally simplified to contain nothing but one single molecule of the compound; hydrogens were removed intentionally, too. For this bug report, only two data sets derived from the entries TARTAC and TARTAC02 are considered, which is about the D-(-)-(2S,3S) isomer among the three possibilities.

After running the computation on the CLI, both the prisitine first model, as well as the second model now described as "aligned" were displayed simultaenously with Jmol. In the case refraining from any form of --use-reflection (no pun intended), the result is well acceptable:

tartac00-tartac02-noreflectionsatall-master

The situation however is bad for --use-reflection as if the two molecules were solely brought in vicinity of each other only:

tartac00-tartac02--use-reflections-master-xyz

In the attached .zip archives, I enclose the raw .xyz files of the models, the .xyz exported by calculate_rmsd.py along python calculate_rmsd.py --reorder -p [--use-reflection] modelA modelB, as well as .png screen photo and *.wrl export of the screne (accessible e.g. by view3dscene in Debian) of two runs with the current master branch version 1.3.0 of the script.

It is noteworthy that the test on these models is not affected if the script is used with or without the optional parameter of --use-reflection or --use-reflections-keep-stereo (RMSD about 0.098) because they represent the same stereoisomer.

sameIsomer-noReflectionsAtAll-master.zip sameIsomer--use-reflections-master.zip

nbehrnd commented 5 years ago

In addition to the previous bugreport, I add below documentation about using the same model data with the script currently filed under "pull request #43" (here). Again, the zip-archive includes the model data and the script used, intermediate outputs obtained, and Jmol's exports as static .png and potentially interactive vrml .wrl.

The superposition in the default mode, in a pattern like

python calculate_rmsd.py --reorder -p modelA modelB

looks like: tartac00-tartac02-newscript-default

The superposition in the pattern of

python calculate_rmsd.py --reorder --use-reflections -p modelA modelB

looks like: tartac00-tartac02-newscript-reflection

Eventually, the deemed to be more (stereoconservative) approach by

python calculate_rmsd.py --reorder --use-reflections-keep-stereo -p modelA modelB

equally looks like:

tartac00-tartac02-newscript-reflectionkeepstereo

xvalidation-tartaricAcids-DKCHNYC-bugreport-20181219.zip

charnley commented 5 years ago

The error originated from the rotation calculated before the reordering when printing the structure. Has been corrected.