Colvars / colvars

Collective variables library for molecular simulation and analysis programs
http://colvars.github.io/
GNU Lesser General Public License v3.0
196 stars 56 forks source link

Question on implementing a new sampling method #698

Closed vineetbansal closed 1 week ago

vineetbansal commented 1 week ago

Hello, Sorry if this is not the correct place for this question, but I'm working on implementing Vendi Sampling on LAMMPS (and hopefully GROMACS too), from a prototype Python implementation.

The basic idea is that in a multi-replica simulation, the atomic positions in the replicas are inspected, evaluated for "diversity" (w.r.t centered/rotated reference positions), and go through an algorithm that gives us a scalar value called the "Vendi Score", the collective potential energy of the ensemble.

I'm trying to understand how to approach this from a development perspective. My understanding so far on reading on LAMMPS and the Colvars module is, that a suitable plan for development might be:

The resulting colvar configuration might look something like this:

colvarsTrajFrequency 5

colvar {
  name atom_positions

  cartesian {
    name xyz
    atoms {
      name ala
      atomNumbersRange 1-22
      centerToReference on
      rotateToReference on
      refPositionsFile alanine-dipeptide-implicit.xyz
    }
  }

}

vendi_sampling {
  name vendi
  colvars atom_positions

  multipleReplicas on
  replicaUpdateFrequency 1
  replicasRegistry vendi-replicas.txt
  outputEnergy on
}

The fix_modify energy option is supported by this fix to add the energy change from the biasing force added by Colvars to the global potential energy of the system as part of thermodynamic output

So this might look something like:

  fix myfix all colvars my.colvars
  fix_modify myfix energy yes
  minimize 0.001 0.001 1000 1000

I'm a software engineer with no background in MD before this, so I'm wondering if someone can review this general plan and see if makes sense? Or perhaps there's a simpler way?