-
Notifications
You must be signed in to change notification settings - Fork 119
Creating custom features #1512
Comments
Hi, could you send us a small test script and/or the full stacktrace? Thanks! |
Sure, here is the full stacktrace. Let me know if you need anything else~
|
One more question, if I only wanted the center of masses of the alpha carbons of the selections, how would I incorporate that into a custom feature? |
Having a closer look at your code, I think the problem is here:
It creates group definitions as a triply-nested list |
Hello, When I change the code as you suggest
The matrix does not reshape properly, into something that is appropriately divisible:
I am generating center of mass distances as 1D points; do I need to keep these 3D? For the other part, I guess I am not clear on whether the indices you give to the |
Regarding your stacktrace: It pretty much already says what is wrong with your code. You reshape traj = md.Trajectory(xyz.reshape(-1, 3, 3), topology=None) meaning that the coordinates are supposed to be of shape distance1 = np.linalg.norm(np.subtract(centers1,centers2)) #does not return a numpy array which returns a single scalar. This is in all likelihood not what you want, rather you want to evaluate the COM distances in every frame. 🙂 |
Thanks! With your help I've made progress. I am trying to use the residue COM definition, where I can add the residue indices I need. However, the code syntax is not the same as the documentation:
What is the difference between residue_indices and residue_atoms, considering both are required arguments here? How do I appropriately call them? It appears only one is requested in the documentation. |
Hi, glad to hear it. The syntax is exactly as in the documentation 😉 What you are trying to do is creating a new instance of |
Thanks for clarifying, it now makes sense how |
Great! I think examples are always good, I am looking forward to a PR! |
Hello,
I am trying to create three features, which I believe need to be created with the
pyemma.coordinates.data.featurization.misc.GroupCOMFeature
(but I could be wrong). I created center of mass a, b, c, and d. I want to measure the distance between group a and d, b and d, and c and d. Here is an example for group a and d:where the commented out
distance1
are things I've tried. Then I load the trajectories with the features:data_2009_glycosylated = pyemma.coordinates.load(trajs1, features=feat_breathing_2009g)
and each time I get the same error:TypeError: 1D weights expected when shapes of a and weights differ.
Clearly, the error is some small syntax. Could you point out what's wrong? Thanks!Best,
Christian
The text was updated successfully, but these errors were encountered: