Shared Coordination Number

38 views
Skip to first unread message

John Hymel

unread,
Jul 21, 2025, 7:19:03 PMJul 21
to PLUMED users

Hello Plumed community,

I'm working on the crystallization of ionic salt hydrates which often feature "shared" water molecules, that is waters which simultaneously reside in the first solvation shell of two different cations. As an example, in CaCl2 hexahydrate, 3 waters are directly coordinated to Ca2+, and the remaining 3 are shared equally between two Ca2+.

The standard COORDINATIONNUMBER CV runs over SPECIESA and sums the switching function contribution for each SPECIESB. In contrast, I'm interesting in a shared coordination number CV that would instead run over unique pairs of SPECIESA and sum the product of switching function contributions of SPECIESB with the pair of SPECIESA. In pseudocode/python:

shared_list = []
for i,j in unique_pairs(SPECIESA):
    shared_CN = 0
    for k in SPECIESB:
         shared_CN += switch(i,k)*switch(j,k)
    shared_list.append(shared_CN)

I have python code for computing this quantity, but would like to construct a MultiColvar within Plumed to calculate it on-the-fly and bias collective properties like the mean, max, or min of this distribution.
  • Is it possible to define such a CV using standard PLUMED functionalities (MATHEVAL, COMBINE, etc)?
  • If not, would this be a reasonable/feasible feature to implement in the C++ layer (as a first time Plumed developer)?
  • Could someone point me toward relevant developer resources or similar custom CV examples to get started?
Any insights/help would be greatly appreciated!

Best,
John

Gareth Tribello

unread,
Jul 22, 2025, 4:45:50 AMJul 22
to plumed...@googlegroups.com
Hello

I think you can achieve what you want using BRIDGE_MATRX:


which is implemented in the master version of PLUMED.  To get the equivalent of the coordination number from the python code in your email you do 

ones: ONES SIZE=<number of atoms in group speciesB> 
cmap: BRIDGE_MATRIX GROUPA=speciesA GROUPB=speciesB GROUPC=speciesB SWITCH={RATIONAL R_0=0.1}
slist: MATRIX_VECTOR_PRODUCT ARG=cmap,ones

slist is a vector of these coordination numbers.  To calculate the average, lowest, and number less than 3 you do:

# This is the average
mean: MEAN ARG=slist PERIODIC=NO
# This is the lowest
lowest: LOWEST ARG=slist
# This is the number less than 3
sf: LESS_THAN ARG=slist SWITCH={RATIONAL R_0=3}
Lt3: SUM ARG=sf PERIODIC=NO

If you look through the manual, you will see that you can do all the operations on the distribution of numbers in this vector.

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/f6d3d05b-2950-4c69-8458-508de6e0a178n%40googlegroups.com.

Message has been deleted

John Hymel

unread,
Jul 25, 2025, 4:29:24 AMJul 25
to PLUMED users
Gareth,

This helps a lot! I was able to get this to work using Plumed-driver (when using the Plumed master version compiled from source), and it gives the expected behavior for my CaCl2 hexahydrate crystal. When trying to compute the same CV on-the-fly using OpenMM (with the OpenMM-Plumed plugin and PlumedForce), I do run into issues where ONES and  BRIDGE_MATRIX are not recognized. Presumably, this is because the version of Plumed that I conda installed with OpenMM wasn't built with the generics libraries, so I'll need to compile OpenMM from source in order to properly connect it to the master version of Plumed. That's the next thing I have to figure out, but getting a working CV was the first step.

Thanks so much,
John
Reply all
Reply to author
Forward
0 new messages