Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About writing NMD file #1656

Closed
TianmingQu opened this issue Feb 8, 2023 · 11 comments
Closed

About writing NMD file #1656

TianmingQu opened this issue Feb 8, 2023 · 11 comments

Comments

@TianmingQu
Copy link

Dear ProDy developer,

Is there anyway I can write an NMD file with the PCA vector or displacement I got from other resources instead of ProDy so that I can visualize it on VMD?

Best,
Tianming

@jamesmkrieger
Copy link
Contributor

jamesmkrieger commented Feb 8, 2023

Hi Tianming,

I'd say the answer is yes. You just need to get your PCA or displacement vectors into ProDy format.

For example,

my_pca = PCA()
my_pca.setEigens(my_vectors, my_variances)

or

my_defvec = Vector(my_vector)

@TianmingQu
Copy link
Author

TianmingQu commented Feb 8, 2023 via email

@jamesmkrieger
Copy link
Contributor

Yes, exactly. Let me know if you have any problems

@TianmingQu
Copy link
Author

Yes, exactly. Let me know if you have any problems

Hi James, I tried to use setEigens today with my eigenvectors and eigenvalues, the array of eigenvectors has a shape (number of atoms, 30) and the eigenvalues has a shape (30,).

When i do setEigens(eigenvectors,eigenvalues), it says the number of vectors and values do not match, is there anyway I can solve this problem?

@jamesmkrieger
Copy link
Contributor

The vectors should be (3*n_atoms, n_modes). Probably that’s the problem. If you want only one coordinate per atom then you should set my_pca._is3d to False first

@jamesmkrieger jamesmkrieger reopened this Mar 6, 2023
@TianmingQu
Copy link
Author

TianmingQu commented Mar 6, 2023 via email

@TianmingQu
Copy link
Author

The vectors should be (3*n_atoms, n_modes). Probably that’s the problem. If you want only one coordinate per atom then you should set my_pca._is3d to False first

Actually I am facing a following problem:

I do pca to water density obtained from each frame and I wonder how I can visualized the fluctuation of water density PCs with Normal mode wizard. I now have the displacements of the water density along each PC and the eigenvalue and eigenvector of each PC.

Do you think there is anyway I can do this in Prody?

@jamesmkrieger
Copy link
Contributor

You could maybe use two objects: one for eigenvectors and one for fluctuations.

The PCA one would be a standard PCA object and I guess the fluctuations would not be 3d.

You could maybe modify the fluctuations object before using setEigens or maybe use a GNM object instead instead of a 3d one.

@jamesmkrieger
Copy link
Contributor

NMWiz shows GNM modes as colours so that may work for fluctuations.

@TianmingQu
Copy link
Author

You could maybe use two objects: one for eigenvectors and one for fluctuations.

The PCA one would be a standard PCA object and I guess the fluctuations would not be 3d.

You could maybe modify the fluctuations object before using setEigens or maybe use a GNM object instead instead of a 3d one.

Could you be more specific on how to make these two objects?

@jamesmkrieger
Copy link
Contributor

Try this:

obj1 = PCA() # is3d True so vectors1 is shape (n_atoms*3, n_modes)
obj1.setEigens(vectors1, evalues)

obj2 = GNM() # is3d False so vectors2 is shape (n_atoms, n_modes)
obj2.setEigens(vectors2, evalues)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants