Unexpected behavior of Center of Mass (com.xyz)

Issue #129 resolved
Former user created an issue

I was expecting that com.xyz as applied below would return center of mass of selected set of residues (B.inds) for all 3000 frames stored in xyz. However, I only only obtain a single value and not a vector containing com of all 3000 frames stored in xyz.

Input

B.inds <- atom.select(pdb, "//B/1:99///CA/") com.xyz(xyz[,B.inds$xyz])

output

B.inds <- atom.select(pdb, "//B/1:99///CA/")

Build selection from input string * Selected a total of: 99 intersecting atoms *

com.xyz(xyz[,B.inds$xyz]) [1] 1.478358 1.479368 1.479699

Comments (2)

  1. Lars Skjærven

    Hi, you're right. at the moment the com.xyz() function only takes a vector as input (as also specified in the documentation). I'll update this tomorrow. In the meantime you can do

    apply(xyz, 1, com.xyz)
    

    Thanks for noting this.

  2. Log in to comment