Restrain a cluster in z-axis

22 views
Skip to first unread message

Jay Shah

unread,
Sep 10, 2025, 1:47:38 PMSep 10
to PLUMED users
Hi,

I have made a group with atoms in a cluster, i want to apply bias potential so that it forms a particular angel with the z axis.
What's the best way to do it and is there a way where i can manually make a virtual atom. 

Thanks, 
Jay
 

Gareth Tribello

unread,
Sep 10, 2025, 4:25:56 PMSep 10
to plumed...@googlegroups.com
Hello

This is an interesting idea, but it is not entirely clear what you want to do.  You can calculate the angle between two vectors.  From your message, it is clear that one of these vectors is the z-axis.  How precisely are you planning on defining a vector from the group of atoms in the cluster?

If you want to make a virtual atom at a particular fixed point in space you use FIXEDATOM

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 visit https://groups.google.com/d/msgid/plumed-users/95299f21-51d6-45ab-86ee-09aab2546fe7n%40googlegroups.com.

Message has been deleted

Jay Shah

unread,
Sep 16, 2025, 4:21:38 AM (10 days ago) Sep 16
to PLUMED users
Thanks Gareth, it helps. 

I am defining the one vector as a principal axis of the cluster and the another vector as z-axis. I am unsure about how to define the bias potential to make that angle zero. 

Gareth Tribello

unread,
Sep 16, 2025, 4:35:13 AM (10 days ago) Sep 16
to plumed...@googlegroups.com
Hi

You can do this with PLUMED.  Here is how:

# Find the gyration tensor of the cluster - in doing the command this way, we are giving a weight of one to each of the atoms
g: GYRATION_TENSOR ATOMS=<atoms>
# Diagonalize the gyration tensor to find the principal eigenvector - the output from this command is a 3-dimensional vector called d.vecs-1
d: DIAGONALIZE ARG=g VECTORS=1
# Calculate the length of the principal eigenvector
v2: CUSTOM ARG=d.vecs-1 FUNC=x*x PERIODIC=NO
mag2: SUM ARG=v2 PERIODIC=NO
mag: CUSTOM ARG=mag2 FUNC=sqrt(x) PERIODIC=NO
# Now get the z-component of the principal eigenvector, as the dot product between the z-axis and the eigenvector is basically the z-component of the eigenvector
zcomp: SELECT_COMPONENTS ARG=d.vecs-1 COMPONENTS=3
# And now calculate the angle
ang: CUSTOM ARG=zcomp,mag FUNC=acos(x/y) PERIODIC=NO    

It is probably not even necessary to calculate the length of the eigenvector as I think that DIAGONALIZE returns normalised eigenvectors.  I would double check that, but if I am right you can just do:

# Find the gyration tensor of the cluster - in doing the command this way, we are giving a weight of one to each of the atoms
g: GYRATION_TENSOR ATOMS=<atoms>
# Diagonalize the gyration tensor to find the principal eigenvector - the output from this command is a 3-dimensional vector called d.vecs-1
d: DIAGONALIZE ARG=g VECTORS=1
# Now get the z-component of the principal eigenvector, as the dot product between the z-axis and the eigenvector is basically the z-component of the eigenvector
zcomp: SELECT_COMPONENTS ARG=d.vecs-1 COMPONENTS=3
# And now calculate the angle
ang: CUSTOM ARG=zcomp FUNC=acos(x) PERIODIC=NO 

Notice, this will only work with v2.10 or a higher version.  I would recommend using the master version of the code, which you can get with the command:


You then compile and build plumed in the usual way.

I hope this helps
Gareth
Message has been deleted

Jay Shah

unread,
Sep 21, 2025, 9:29:17 AM (5 days ago) Sep 21
to PLUMED users

This is really helpful. Thanks a lot Gareth !!
Best, 
Jay
Reply all
Reply to author
Forward
0 new messages