How to plot RDFs for NPT simulations?

321 views
Skip to first unread message

Ant

unread,
Oct 23, 2019, 5:05:15 AM10/23/19
to cp2k
I am re-posting a question I already asked in the hope that someone who can help will see it. 

I already have NPT simulation results and would like to plot RDFs.  I usually use VMD, but the RDF GUI only allows a single set of cell parameters.  I need to be able to enter a distinct set of cell parameters at each time step. 

Does anyone know whether it is possible to do this in VMD or if there is another piece of software that can do it?  I have not found anything in my own searches.  Thank you.

Josip Lovrić

unread,
Oct 23, 2019, 5:09:16 AM10/23/19
to cp...@googlegroups.com
Have you checked mdanalysis? They have nice libraries for reading data and also analyze.

Josip

--
You received this message because you are subscribed to the Google Groups "cp2k" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cp2k+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cp2k/a3b9d101-d815-4a85-b54e-c7879bda352d%40googlegroups.com.

Ant Stone

unread,
Oct 23, 2019, 5:22:30 AM10/23/19
to cp...@googlegroups.com
Thank you, Josip.  Yes, I just checked it out.  Unfortunately, I don't see how it's possible to combine CP2K's .xyz and .cell files there to generate an RDF. 

There's a function at MDAnalysis called something like "InterRDF" and its arguments appear to be atom types.  Maybe I'm missing something, but I don't see how to correct our CP2K .xyz trajectory files according to our .cell files using MDAnalysis.

Josip Lovrić

unread,
Oct 23, 2019, 6:19:31 AM10/23/19
to cp...@googlegroups.com
Put output to .crd file for example.

On Wed, Oct 23, 2019, 11:22 AM Ant Stone <ant...@gmail.com> wrote:
Thank you, Josip.  Yes, I just checked it out.  Unfortunately, I don't see how it's possible to combine CP2K's .xyz and .cell files there to generate an RDF. 

There's a function at MDAnalysis called something like "InterRDF" and its arguments appear to be atom types.  Maybe I'm missing something, but I don't see how to either correct our CP2K .xyz trajectory files according to our .cell files using MDAnalysis.

--
You received this message because you are subscribed to the Google Groups "cp2k" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cp2k+uns...@googlegroups.com.

Ant

unread,
Oct 23, 2019, 7:13:41 AM10/23/19
to cp2k
Sorry, Josip, I'm pretty new to this.  I can find out what .crd is.  Which output should I put in .crd form?  Thank you.

Josip Lovrić

unread,
Oct 23, 2019, 7:23:15 AM10/23/19
to cp...@googlegroups.com

sri, 23. lis 2019. u 13:13 Ant <ant...@gmail.com> napisao je:
Sorry, Josip, I'm pretty new to this.  I can find out what .crd is.  Which output should I put in .crd form?  Thank you.

--
You received this message because you are subscribed to the Google Groups "cp2k" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cp2k+uns...@googlegroups.com.

Ant

unread,
Oct 23, 2019, 1:27:46 PM10/23/19
to cp2k
If anyone knows how to make RDFs for NPT simulation results that already exist, it would be great to know.
Message has been deleted

Ant

unread,
Oct 23, 2019, 3:52:29 PM10/23/19
to cp...@googlegroups.com
Thank you very much, Travis!

Here are the first few lines of a .cell file directly from CP2K (below).  My cells are all cubic (90 degree angles, equal dimensions), so I can change these to three columns; e.g., Ax, By, Cz.

Step   Time [fs]       Ax [Angstrom]       Ay [Angstrom]       Az [Angstrom]       Bx [Angstrom]       By [Angstrom]       Bz [Angstrom]       Cx [Angstrom]       Cy [Angstrom]       Cz [Angstrom]      Volume [Angstrom^3]

       0       0.000       13.6105000000        0.0000000000        0.0000000000        0.0000000000       13.6105000000        0.0000000000        0.0000000000        0.0000000000       13.6105000000          2521.2867393576

       1       0.500       13.6102685896        0.0000000000        0.0000000000        0.0000000000       13.6102685896        0.0000000000        0.0000000000        0.0000000000       13.6102685896          2521.1581382194

       2       1.000       13.6101388560        0.0000000000        0.0000000000        0.0000000000       13.6101388560        0.0000000000        0.0000000000        0.0000000000       13.6101388560          2521.0860435793

       3       1.500       13.6101072636        0.0000000000        0.0000000000        0.0000000000       13.6101072636        0.0000000000        0.0000000000        0.0000000000       13.6101072636          2521.0684874332


This is finally making sense.  Now I understand why I have a problem.  My simple XYZ trajectories don't contain my cell dimensions.  Your code adds the cell dimensions and then I can read that new file right into the GUI where I would usually read in my simple XYZ file.  It's great to finally understand what is going on.  Thank you very much.
Message has been deleted

Ant

unread,
Oct 23, 2019, 4:43:47 PM10/23/19
to cp2k
Thank you again for your help.  Really appreciate it.  I'll try it out!

Ant Stone

unread,
Oct 25, 2019, 12:03:22 PM10/25/19
to cp...@googlegroups.com
Travis, I used your code with my .cell file and trajectory (.xyz) files--thank you.  Would you happen to have time for a couple of follow-up questions on this?

1. It generated an output file like the one at the end of this message. When I read it into VMD, it seemed to show all atoms as identical (i.e., the atom types are not distinguished).  I'm guessing this has something to do with the first and second columns.  I can't find an example online of what they should be. 

2. Another problem is that the output file only contains about 300 time steps.  This may not be something you can help with, but I thought I would mention it just in case.  Thank you again very much.

TITLE
Gromos96 structure file written by ASE
END
POSITION
    1 DUM   Ar         1    0.271226802    1.105695742    0.687656962
    1 DUM   Ar         2    0.171226802    0.705695742    0.287656962
    1 DUM   Cl         3    0.987788274    0.553369424    0.340889882
    1 DUM   Cl         4    1.017388949    1.095946397    1.012254758
    1 DUM   O         5    0.171226802    1.056957424    0.287656962
    1 DUM   O         6    0.087788274   -0.053369424    0.040889882
    1 DUM   H         7    0.017388949    0.695946397   -0.212254758
    1 DUM   H         8   -0.809217934    0.646737810    0.262515118
   ...
   ...
END
BOX
    1.361050000    1.361050000    1.361050000    0.000000000    0.000000000    0.000000000    0.000000000    0.000000000    0.000000000
END
Message has been deleted

Ant Stone

unread,
Oct 25, 2019, 1:19:29 PM10/25/19
to cp...@googlegroups.com
Thank you very much for your reply, Travis. 

1. This is also what I thought--that I should be able to select particular atoms by name according to column 3.  This is what I'm doing in the RDF GUI ("name O," etc).  However, when I load the file into VMD, I notice that the atoms are not distinguished.  They're all the same color--so I assumed the types aren't being recognized--and the RDF also doesn't look right.  From what you're saying, the dummy variable are not a problem and I need to keep looking for a different explanation, so thanks for that advice.  The original .xyz file loads correctly into VMD.

2. Yes, the cell parameters and coordinates are outputted at the same frequency.  Again, thank you for confirming what should be going on.  I will need to keep looking for the reason this is happening. 

Appreciate your help a lot.  Thanks.

Ant Stone

unread,
Oct 25, 2019, 3:51:14 PM10/25/19
to cp...@googlegroups.com
Problem solved.  Thank you very much!

Ke Zhou

unread,
Oct 29, 2019, 10:10:22 PM10/29/19
to cp2k
I think the RDF only depends on the position of particles. So you can use any codes you can download to calculate RDF.
Here, the position of particles should be Unwrapped, which means the position should not be wrapped back into the periodic box.  
As for the density for normalization of RDF, I think you can use optimized density.

Best,
Justin


在 2019年10月23日星期三 UTC+8下午5:05:15,Ant写道:
Reply all
Reply to author
Forward
0 new messages