Switching function on DISTANCES components

20 views
Skip to first unread message

Arthur France-Lanord

unread,
Sep 17, 2025, 6:19:07 AM (9 days ago) Sep 17
to PLUMED users
Hi, 

I'd like to compute a set of distances between specific pairs of atoms, using the multicolvar DISTANCES with pairs specified as ATOMS1, ATOMS2, ..., ATOMSn. I'd like to transform these distances into a quantity smoothly varying from 1 to 0. I would have used the COORDINATIONNUMBER multicolvar, but I don't think one can input specific pairs of atoms. 

Is there a way to add a switching function to each component of the DISTANCES multicolvar? I don't see SWITCH as an option to the action. 

thanks, 
Arthur

Arthur France-Lanord

unread,
Sep 17, 2025, 6:23:25 AM (9 days ago) Sep 17
to PLUMED users
Actually I think I can do this with the MTRANSFORM_* actions

Gareth Tribello

unread,
Sep 17, 2025, 6:39:03 AM (9 days ago) Sep 17
to plumed...@googlegroups.com
Hello

This is much easier to do if you use version 2.10 or the master version of Plumed.  For those versions of PLUMED you can use an input like this:

d: DISTANCE ATOMS1=1,2 ATOMS2=3,4 ATOMS3=5,6
c: CUSTOM ARG=d FUNC=x*x PERIODIC=NO

In this input a vector of distances is passed to the CUSTOM action.  The function (in this case squaring the eleemnts of the input vector) is applied elementwise to this vector so the output is a vector that contains the squares of the input distances.

As it is a CUSTOM action you can do whatever you want to the input vector.

Notice also that instead of using CUSTOM you can do:

d: DISTANCE ATOMS1=1,2 ATOMS2=3,4 ATOMS3=5,6
c: LESS_THAN ARG=d SWITCH={RATIONAL R_0=0.1}

which will output a vector that contains all the distances transformed by a switching function.

To get the new version of the code use the command:


and then compile and build in the normal way.

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/0fc10b41-a04e-4593-baa0-c840a0c68169n%40googlegroups.com.

Message has been deleted

Arthur France-Lanord

unread,
Sep 21, 2025, 9:27:55 AM (5 days ago) Sep 21
to PLUMED users
OK good to know, perhaps it's time to switch to 2.10 then! 

Arthur
Reply all
Reply to author
Forward
0 new messages