plumed2
plumed2 copied to clipboard
Minimum Spanning Tree for Adjacency Matrix
I want to create an action which can calculate the minimum spanning tree for the adjacency matrix of the cluster. And also this action would calculate the sum of the weights of the edges in this minimum spanning tree. This sum needs to be used as a bias parameter(differentiable) in the simulation. Do you think it's doable by just writing an new action under ./src/adjmat directory?
Thanks!
Hello @xyli28
I am sorry for taking a while to get back to you on this. I think this is possible and it can be done quite easily especially if you use boost to calculate the minimal spanning tree:
http://www.boost.org/doc/libs/1_35_0/libs/graph/doc/kruskal_min_spanning_tree.html
Having said that though I am somewhat confused by what you are trying to do. The weights of the adjacency matrix are calculated by transforming the distances between atoms using switching functions. The low weight connections thus come from atoms that are far apart. Your minimal spanning tree would thus connect the atoms that are far apart most strongly. Is that what you want to do? I am somewhat intrigued.
Hi Gareth,
Thank you for your replying. In terms of your concern, here is what I'm thinking:
My goal is to force all the solute atoms to maintain as a cluster. But I don't want to add any bias on any specific morphology. So I choose to use minimum spanning tree. I will manipulate the switching function to make the weight of the edge close to 1 when atoms are connected. When atoms are far away to each other, then the weight would become very large. In simulation, I will calculate the MST and multiply weights of all edges in the MST. If the cluster isn't falling apart, the product should be close to one. But even if there is only one atom far away from all other atoms, the product would be very large. I will constrain the value of the product close to 1 to force the cluster not to collapse.
Have a good day!
Thanks for explaining this more. It would be difficult to do this with the way that the adjacency matrix is implemented within PLUMED at present. I am working on a new branch that I think will make doing this calculation much easier. As such if you are willing to wait a couple of weeks and if you are willing to work with a branch that may contain some bugs we can implement it in there.
What do you think @xyli28? Thanks Gareth
Hi Gareth,
That's great! I can wait for a couple of weeks and I don't mind if there are some bugs. Thank you very much for this help. Please let me know if you need more information or when you are done with this new branch.
Have a good day!
Xinyi