Or using cctbx:

****
from scitbx.array_family import flex
import iotbx.pdb

def run():
  xyz_1 = iotbx.pdb.input(file_name="file_1.pdb").atoms().extract_xyz()
  xyz_2 = iotbx.pdb.input(file_name="file_2.pdb").atoms().extract_xyz()
  print flex.mean(flex.sqrt((xyz_1 - xyz_2).dot()))

if (__name__ == "__main__"):
  run()
****

Pavel


On Mon, Aug 28, 2017 at 9:46 AM, Tristan Croll <[email protected]> wrote:

> I should learn not to post while distracted. That last line was both
> over-engineered, and wrong. What you want is:
>
> rmsd = sum(numpy.linalg.norm(xyz1-xyz2, axis=1))/len(xyz1)
>
>
> On 2017-08-28 14:32, Tristan Croll wrote:
>
>> In this case calculating the rmsd is easy:
>>
>> - get the coordinates of each structure as n x 3 numpy arrays. The
>> Pymol commands for this should look like:
>>
>> xyz1 = cmd.get_coords('sele1', 1)
>> xyz2 = cmd.get_coords('sele2', 1)
>>
>> Then,
>>
>> rmsd = numpy.linalg.norm(numpy.sqrt((xyz1-xyz2)**2), axis=1)
>>
>> Tristan Croll
>> Research Fellow
>> Cambridge Institute for Medical Research
>> University of Cambridge CB2 0XY
>>
>> On 28 Aug 2017, at 10:04, Johannes Sommerkamp
>> <[email protected]> wrote:
>>
>> Thanks a lot for your answers and the PyMOL mailing list hint. I
>>> didnt had in mind this list.
>>>
>>> I read the Pymol Wiki. The commands
>>>
>>> align moving, target, cycles=0, transform=0
>>>
>>> align moving, target, cycles=0
>>>
>>> give identical values for RMSD. So, the only difference is, that
>>> the moving structure is not moved in the graphical output.
>>> Additionally the RMSD with the argument cycles=0 can't be the RMSD
>>> before any movement because the values differ for the super and the
>>> align command. I think its just without refinement.
>>> Since the two structure I want to compare are already aligned based
>>> on the central beta sheet CA atoms, I want to calculate the RMSD
>>> without any movement.
>>>
>>> Regards
>>> Johannes
>>>
>>> On 27/08/17 19:18, Folmer Fredslund wrote:
>>> Hi Johannes,
>>>
>>> Did you read the PymoWIKI entry on the align command?
>>>
>>> https://pymolwiki.org/index.php/Align#RMSD [1]
>>>
>>> I think this should give you what you want within PyMOL.
>>>
>>> Btw, there is a nice dedicated PyMOL mailing list
>>> https://pymolwiki.org/index.php/PyMOL_mailing_list [2]
>>> It is rather low traffic, but the replies are generally from the
>>> developers or very knowledgeable users.
>>>
>>> Hope this helps,
>>> Folmer Fredslund
>>>
>>> On 2017-08-27 13:09, Johannes Sommerkamp wrote:
>>> Hello everybody,
>>> I have superposed two structures based on the central beta-sheet CA
>>> atoms with the "super" command in Pymol.
>>> Now, I want to calculate the RMSD between ALL atoms or ALL CA atoms
>>> without moving the structures again. The rms_cur command in Pymol
>>> would do that, but only works if all atom identifiers match. Adding
>>> "transform=0" to the super, oder align command still does the
>>> alignment and moves the structure but does not show the movement.
>>>
>>> Is there an easy way to just calculate the all atom RMSD between
>>> two already superposed structures in pymol or any other programm?
>>>
>>> Thanks in advance!
>>> Johannes
>>>
>>
>> --
>> Johannes Sommerkamp
>> Ruhr-Universität Bochum
>> AG Röntgenstrukturanalyse an Proteinen, LS Biophysik, ND04/396
>> Universitätsstraße 150
>> 44801 Bochum
>> Tel: +49-(0)234/32-25754
>>
>>
>> Links:
>> ------
>> [1] https://pymolwiki.org/index.php/Align#RMSD
>> [2] https://pymolwiki.org/index.php/PyMOL_mailing_list
>>
>

Reply via email to