Question about principal axes of inertia

189 views
Skip to first unread message

Davide Luciano

unread,
Nov 17, 2022, 1:11:30 PM11/17/22
to PLUMED users
Hi all, 

I'm trying to use the principal axes of inertia of a protein in order to define two angles as CVs for a metadynamics. I'm just wondering  whether is possible to get the eigenvectors of the inertia tensor, for example from  GYRATION,  instead of just the eigenvalues.

Thank you. 
Davide

Gareth Tribello

unread,
Nov 18, 2022, 12:41:40 PM11/18/22
to plumed...@googlegroups.com
Hello 

You can do this if you are willing to use an experimental version of PLUMED 2.  To get this version of plumed you need to issue the following commands:

git checkout hack-the-tree

You can then use an input like this:

# Calculate the gyration tensor (here we are doing it mass weighted if you have not weights keyword you can do the geometric centre)
rgyt: GYRATION_TENSOR ATOMS=<the list of the atoms invovled> WEIGHTS=@Masses
# Diagonalise the gyration tensor
rgyr_diag: DIAGONALIZE ARG=rgyt VECTORS=all
# now print the principle eigenvector
PRINT ARG=rgyr_diag.vecs-1

Notice that this version of PLUMED allows you to pass vectors and matrices between actions as well as scalars.  If you wanted to calculate the angle between a distance and the eigenvector you could do something like this:

# Calculate the vector between two atoms
dd: DISTANCE ATOMS=1,2 COMPONENTS
# Convert the three scalars that are calculated by dd to a vector
ddv: CONCATENATE ARG1=dd.x ARG2=dd.y ARG3=dd.z
# Now take the dot product between ddv and rgyr_diag.vecs-1
dip: CUSTOM ARG1=rgyr_diag.vecs-1 ARG2=ddv FUNC=x*y PERIODIC=NO
dp: SUM ARG=dip PERIODIC=NO

You should be able to do something similar to get the angle.

I hope this helps
Gareth


--
You received this message because you are subscribed to the Google Groups "PLUMED users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to plumed-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/plumed-users/5221d7a1-342a-4a3f-9ba2-73e4c244e75dn%40googlegroups.com.

Davide Luciano

unread,
Feb 9, 2023, 8:57:17 AM2/9/23
to PLUMED users
Hi Tribello,

Thank you very much for the advice. I made some tests but got a parsing error, plumed wasn't able to recognize the keyword GYRATION_TENSOR.

These days I am trying to compile this version on a server but get a compilation error.

I've attached the printout of configure and make.
config.log
make.log

Gareth Tribello

unread,
Feb 9, 2023, 9:10:02 AM2/9/23
to plumed...@googlegroups.com
Hello

I had a look at the log files you sent and they are strange. You get some warnings but there is nothing that I can see in there that would prevent the code from compiling. Is anything output to standard error?

Not sure about the parse error. Without seeing the specific error you were getting it is difficult to say.

Thanks
Gareth

> On 9 Feb 2023, at 08:57, Davide Luciano <luciano.davide...@gmail.com> wrote:
>
> <make.log>

Davide Luciano

unread,
Feb 9, 2023, 10:15:58 AM2/9/23
to plumed...@googlegroups.com
Hi, 

If I run  "make install" it crashes here:

compiling  DataPassingTools.cpp
In file included from DataPassingTools.cpp:22:
DataPassingTools.h:34:15: error: 'unique_ptr' in namespace 'std' does not name a template type
   34 |   static std::unique_ptr<DataPassingTools> create(unsigned n);
      |               ^~~~~~~~~~
DataPassingTools.h:27:1: note: 'std::unique_ptr' is defined in header '<memory>'; did you forget to '#include <memory>'?
   26 | #include <map>
  +++ |+#include <memory>
   27 |
DataPassingTools.cpp:38:35: error: no declaration matches 'std::unique_ptr<PLMD::DataPassingTools> PLMD::DataPassingTools::create(unsigned int)'
   38 | std::unique_ptr<DataPassingTools> DataPassingTools::create(unsigned n) {
      |                                   ^~~~~~~~~~~~~~~~
DataPassingTools.cpp:38:35: note: no functions named 'std::unique_ptr<PLMD::DataPassingTools> PLMD::DataPassingTools::create(unsigned int)'
In file included from DataPassingTools.cpp:22:
DataPassingTools.h:32:7: note: 'class PLMD::DataPassingTools' defined here
   32 | class DataPassingTools {
      |       ^~~~~~~~~~~~~~~~
make[7]: *** [../maketools/make.rules:21: DataPassingTools.o] Error 1
make[7]: Leaving directory '/home/nmrbox/0030/dluciano/plumed2/src/core'
make[6]: *** [Makefile:423: ../core] Error 2
make[6]: Leaving directory '/home/nmrbox/0030/dluciano/plumed2/src/lib'
make[5]: *** [Makefile:128: dirs] Error 2
make[5]: Leaving directory '/home/nmrbox/0030/dluciano/plumed2/src/lib'
make[4]: *** [Makefile:111: all] Error 2
make[4]: Leaving directory '/home/nmrbox/0030/dluciano/plumed2/src/lib'
make[3]: *** [Makefile:132: install-build] Error 2
make[3]: Leaving directory '/home/nmrbox/0030/dluciano/plumed2/src/lib'
make[2]: *** [Makefile:257: install] Error 2
make[2]: Leaving directory '/home/nmrbox/0030/dluciano/plumed2/src/lib'
make[1]: *** [Makefile:11: install] Error 2
make[1]: Leaving directory '/home/nmrbox/0030/dluciano/plumed2/src'
make: *** [Makefile:35: install] Error 2



--
You received this message because you are subscribed to a topic in the Google Groups "PLUMED users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/plumed-users/JoV6hZrFTwk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to plumed-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/plumed-users/C79FAA64-FFF1-4642-96B7-107387A221D4%40gmail.com.

Gareth Tribello

unread,
Feb 9, 2023, 9:25:23 PM2/9/23
to plumed...@googlegroups.com
I think based on the error message if you add the command 

#include <memory>

In the file 

plumed2/src/core/DataPassingTools.h

It might then compile. Not sure why that works on other machines but not on yours. Give it a try though and let me know how it goes. 

Good luck
G

You received this message because you are subscribed to the Google Groups "PLUMED users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to plumed-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/plumed-users/CAL9%3DEsm6UO48uz2xbQkb8ngESP%3DAsX3nXnYfWC655CvmSq0AhA%40mail.gmail.com.

Davide Luciano

unread,
Feb 10, 2023, 9:12:12 AM2/10/23
to plumed...@googlegroups.com
I did it and it worked, I also tried it on my local machine and I run into the same problem. 

As a test, I would like to get the gyration eigenvectors from a gromacs trajectory.

This is my plumed file:
#MOL info
MOLINFO STRUCTURE=ref.pdb



# Calculate the gyration tensor (here we are doing it mass weighted if you have not weights keyword you can do the geometric centre)
rgyt: GYRATION_TENSOR ATOMS=@all

# Diagonalise the gyration tensor
rgyr_diag: DIAGONALIZE ARG=rgyt VECTORS=all
# now print the principle eigenvector
PRINT ARG=rgyr_diag.vecs-1 FILE=INERTIA

I run it using the command: ~/plumed/bin/plumed driver --plumed plumed.dat --ixtc md.xtc

and the output is:

PLUMED: PLUMED is starting
PLUMED: Version: 2.8.1 (git: Unknown) compiled on Nov 21 2022 at 16:13:35
PLUMED: Please cite these papers when using PLUMED [1][2]
PLUMED: For further information see the PLUMED web page at http://www.plumed.org
PLUMED: Root: /Ubuntu-20.04/plumed/plumed/lib/plumed
PLUMED: For installed feature, see /Ubuntu-20.04/plumed/plumed/lib/plumed/src/config/config.txt
PLUMED: Molecular dynamics engine: driver
PLUMED: Precision of reals: 8
PLUMED: Running over 1 node
PLUMED: Number of threads: 1
PLUMED: Cache line size: 512
PLUMED: Number of atoms: 150649
PLUMED: File suffix:
PLUMED: FILE: plumed.dat
PLUMED: Action MOLINFO
PLUMED:   with label @0
PLUMED:   pdb file named ref.pdb contains 1 chains
PLUMED:   chain named X contains residues 13 to 384 and atoms 1 to 5854
PLUMED: ERROR
PLUMED: I cannot understand line: GYRATION_TENSOR LABEL=rgyt ATOMS=@all
PLUMED: Maybe a missing space or a typo?
PLUMED:
PLUMED: ################################################################################
PLUMED:
PLUMED:
PLUMED: +++ PLUMED error
PLUMED: +++ at PlumedMain.cpp:743, function void PLMD::PlumedMain::readInputWords(const std::vector<std::__cxx11::basic_string<char> >&)
PLUMED: +++ message follows +++
PLUMED: ERROR
PLUMED: I cannot understand line: GYRATION_TENSOR LABEL=rgyt ATOMS=@all
PLUMED: Maybe a missing space or a typo?
PLUMED:
PLUMED: ################################################################################


If i check the file  src/colvar/Gyration.cpp I can see the line PLUMED_REGISTER_ACTION(Gyration,"GYRATION_TENSOR").

what could be the problem?


Gareth Tribello

unread,
Feb 10, 2023, 5:41:16 PM2/10/23
to plumed...@googlegroups.com
Can you try 

cd plumed2
make clean
./configure --enable-modules=all
make

I can't remember if the gyration tensor code is enabled by default or not. 

Let me know how that goes.
Sorry this is a pain
G

Davide Luciano

unread,
Feb 11, 2023, 5:06:56 PM2/11/23
to plumed...@googlegroups.com
I tried to enable all modules but there was an error in the FFTW module, so I used ./configure --prefix=$HOME/plumed --enable-modules=all --enable-fftw=no. I repeated the test but I got the same error. 



Massimiliano Bonomi

unread,
Feb 11, 2023, 5:44:20 PM2/11/23
to plumed...@googlegroups.com
If this is what you are looking for (have a look at the different TYPE)


It is enabled by default.
Sent from my iPad

On 11 Feb 2023, at 18:07, Davide Luciano <luciano.davide...@gmail.com> wrote:



Gareth Tribello

unread,
Feb 11, 2023, 6:16:34 PM2/11/23
to plumed...@googlegroups.com
Hello

I don’t think the original thing you asked for, the eigenvectors of the gyration tensor can be extracted from the implementation in the master version of plumed.  Perhaps I am wrong though.

On hack-the-tree I am a bit mystified.  The only thing I can think of is that you are not executing the version of plumed that you just compiled.  Can you double check that you are definitely running the version you compiled from the hack-the-tree branch.  Make sure that there isn’t some other version of PLUMED that is in your path that is running when you try to run PLUMED.

I’m sorry that advice seems patronising but I really can’t think of anything else.  The code is there.

I hope this helps
Gareth

Davide Luciano

unread,
Feb 16, 2023, 10:00:26 AM2/16/23
to plumed...@googlegroups.com
Hello

Yes in the master with the keywords GTPC_i I can get the eigenvalues but not the eigenvectors. 

I tried to compile it on a machine without plumed and it worked, so it was using the wrong lib. 

I'm trying to start a simulation using the attached files but I get the following error:

+++ PLUMED error
+++ at PlumedMain.cpp:671, function void PLMD::PlumedMain::setInputValue(const
string&, const unsigned int&, void*)
+++ assertion failed: found
+++ message follows +++
found no action to set named lambda

Thank you for the help!

Davide

inertia.dat
plumed.dat

Gareth Tribello

unread,
Feb 16, 2023, 11:31:59 AM2/16/23
to plumed...@googlegroups.com
What MD code are you running this with?

Gareth

Davide Luciano

unread,
Feb 16, 2023, 11:55:01 AM2/16/23
to plumed...@googlegroups.com
GROMACS 2021.7

Davide

Gareth Tribello

unread,
Feb 16, 2023, 12:04:51 PM2/16/23
to plumed...@googlegroups.com
Hello 

Could we do a Zoom call about this?  Monday morning would be good for me or Tuesday anytime.  We can then look at it together on your machine and see if we can work out what is going on?

Thanks
Gareth

Davide Luciano

unread,
Feb 16, 2023, 12:16:20 PM2/16/23
to plumed...@googlegroups.com
Yes sure, Monday morning works for me. Could you send me the link to davide....@ntnu.no?

Thank you very much. 
Davide 

Reply all
Reply to author
Forward
0 new messages