Printing stress tensor from an existing trajectory

63 views
Skip to first unread message

Léon Luntadila Lufungula

unread,
Jan 12, 2024, 4:16:16 AMJan 12
to cp2k
Dear all,

I calculated an NPT trajectory and wanted to see how the pressure fluctuated during the MD run, however, I forgot to add the MOTION/PRINT/STRESS keyword so I don't have my stresses. Is there a way to create the file with the stresses after the fact without re-doing the whole trajectory? Perhaps with the REFTRAJ keyword? I don't have any experience with it, but I think it might pose a solution if I read the documentation...

Kind regards,
Léon

Krack Matthias

unread,
Jan 12, 2024, 5:22:39 AMJan 12
to cp...@googlegroups.com

Dear Léon

 

I am afraid, it is not possible to recover the stresses a posteriori from a NpT run. The stresses obtained with REFTRAJ would miss the kinetic energy contribution to the total stress tensor.

 

HTH

 

Matthias

 

--
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/fa512d0f-ede4-4ed7-ad14-92b512851a8fn%40googlegroups.com.

Léon Luntadila Lufungula

unread,
Jan 12, 2024, 6:25:29 AMJan 12
to cp2k
Dear Matthias,

Thanks for the quick reply, it wasn't a very expensive calculation so it doesn't matter if I'll have to re-do it. I'll keep this in mind for the future so that I don't forget this again.

Kind regards,
Léon

Léon Luntadila Lufungula

unread,
Jan 17, 2024, 7:47:16 AMJan 17
to cp2k
Dear Matthias,

Perhaps this is a stupid question, but I want to calculate the pressure from the stress tensor to see if my NPT trajectory is keeping the pressure constant along its trajectory and I'm a bit unsure about how to do this. Is this just taking the average of the diagonal elements of the stress tensor or is it more complex than this?

Kind regards,
Léon

Krack Matthias

unread,
Jan 18, 2024, 3:59:27 AMJan 18
to cp...@googlegroups.com

Dear Léon

 

yes, the pressure is calculated from the average of the three diagonal elements divided by the cell volume.

 

Best

 

Matthias

 

Léon Luntadila Lufungula

unread,
Jan 18, 2024, 5:41:46 AMJan 18
to cp2k
Dear Matthias,

I've done some checking myself, by comparing my calculated value with that reported in the MD section of the output and the reported value in the output does seem to coincide with just the average of the diagonal elements of the stress tensor as outputted by MOTION/PRINT/STRESS, without dividing by the cell volume... The elements of the stress tensor are already given in bar so dividing by the cell volume would give units of bar/Å^3 and not bar. So is it correct that the pressure is just equal to the average of the diagonal elements or does one need to take into account the cell volume as you suggested?

Kind regards,
Léon

P.S. Thanks to all of you from CP2K (Matthias, Jürg, Matt, ...) for being so responsive this last week, it has really helped me in getting my calculations and analysis of the results up and running in a short time!

Krack Matthias

unread,
Jan 18, 2024, 8:14:57 AMJan 18
to cp...@googlegroups.com

Dear Léon

 

That’s correct, the values in the .stress file have already been divided by the cell volume and thus the total pressure in bar can be calculated as (p(xx) + p(yy) + p(zz))/3.

 

Best

 

Matthias

 

Léon Luntadila Lufungula

unread,
Jan 18, 2024, 8:30:01 AMJan 18
to cp2k
Dear Matthias,

Thanks for the confirmation! 

Kind regards,
Léon
Reply all
Reply to author
Forward
0 new messages