Calculating Center of Mass of a protein and the corressponding displacement over the entire MD trajectory

Issue #863 resolved
Nelson created an issue

Existing com function example allows for calculation for a single pdb file. How do I incorporate the function to measure and record the com for the protein over the timespan of the simulation?

As of now I am using this code:

library(Bio3D)pdb <- read.pdb(file.choose())dcd <- read.dcd(file.choose())sele <- atom.select(pdb, "calpha", chain="C", verbose=TRUE)

com(pdb, sele)

which gives an output:

  x        y          z

[1,] 27.68006 5.642134 -0.5211408

library(Bio3D)pdb <- read.pdb(file.choose())dcd <- read.dcd(file.choose())sele <- atom.select(pdb, "calpha", chain="C", verbose=TRUE)xyz <- fit.xyz(fixed=pdb$xyz, mobile=dcd,fixed.inds=sele$xyz,mobile.inds=sele$xyz)dim(xyz) == dim(dcd)xyz1 <- pdb$xyz[, sele$xyz]com.xyz(xyz1)

which gives an exact similar output:

‌ x y z

[1,] 27.68006 5.642134 -0.5211408

I realize that the displacement can be measured through a distance matrix plot based on the variance across the CoM coordinates for the selected chain. Looked it up in another ISSUE associated with CoM.

Could you help me as to how to determine the variance across CoM for the selected chain?

Comments (4)

  1. Xinqiu Yao

    To calculate the ‘com’ for a simulation trajectory, use the trajectory “xyz” as input. For example, com(dcd[, sele$xyz])

  2. Nelson reporter

    I encountered this error.

    Error in UseMethod("com") :no applicable method for 'com' applied to an object of class "c('matrix', 'array', 'double', 'numeric')"

    > library(bio3d)
    > pdb <- read.pdb(file.choose())
    > dcd <- read.dcd(file.choose())
    > sele <- atom.select(pdb, "calpha", resno=1144:1160, verbose=TRUE)
    > xyz <- fit.xyz(fixed=pdb$xyz, mobile=dcd,
    +                fixed.inds=sele$xyz,mobile.inds=sele$xyz)
    > dim(xyz) == dim(dcd)
    com(dcd[, sele$xyz])
    Error in UseMethod("com") : 
      no applicable method for 'com' applied to an object of class "c('matrix', 'array', 'double', 'numeric')"
    

  3. Nelson reporter

    It worked for me. I was calling the wrong function. This worked:

    com.xyz(dcd[, sele$xyz])
    

    Thanks!

  4. Log in to comment