[lammps-users] LAMMPS Colvars Module

Hi. I’m using the LAMMPS colvars module to evaluate the free energy of adsorption of a molecule from a solid surface. I have run some simple tests from the example script in github and applied the module to my case, in which I found some questions. For all the questions, I have attached the colvars configuration file and the simulated videos in this link: https://drive.google.com/drive/folders/1MnsqPZKNrSivFZLo2UxvVmrO2bAL8KO5?usp=sharing . I will include the colvars content here as well.

  1. Question 1: For this testing case, a water molecule pulled away from the solid calcite surface in Z direction, I used the distanceZ collective variable and umbrella sampling module, setting the center 5 to target center 15. The molecule is pulled awayed in the intended direction, Z axis but the molecule suddenly fluctuates around in the Z direction… May I know what I should implement in the code to ensure it is pulled consistently without moving around? The PMF result generated looks logical anyway.

colvar {
name dist

width 0.1 # Spacing of grids
lowerBoundary 0.0
upperBoundary 15.0 # Determined by size of unit cell used
hardLowerBoundary yes # Inform biases that lower boundary won’t be crossed
hardUpperBoundary yes # Inform biases that upper boundary won’t be crossed
outputAppliedForce on # keep track of bias force on this variable

distanceZ {

axis (0.0, 0.0, 1.0) #Ensure the projection of distance vector on z axis
main {
atomNumbersRange 301-303
}
ref {
atomNumbersRange 1-300
}
}
}

harmonic {
name h_pot
colvars dist
forceConstant 1
centers 5
targetCenters 15
targetNumStages 19
targetNumSteps 50000
outputCenters yes # Write the current centers to the trajectory file
writeTIPMF yes

#outputAccumulatedWork yes # keep track of how much energy will be added
}

  1. Question 2: For the adaptive biasing force abf module. The abf module looks easier to run with the simple code. When I visualize the file, the molecule is just maintained in the same initial position till the end of the simulation. However, the PMF module shows the grid spacing from the initial distance to the final distance, and the PMF value is the same along the coordinate. The results seem weird and how should I use ABF properly?

colvar {
name dist

width 0.1 # Spacing of grids
lowerBoundary 0.0
upperBoundary 15.0 # Determined by size of unit cell used
hardLowerBoundary yes # Inform biases that lower boundary won’t be crossed
hardUpperBoundary yes # Inform biases that upper boundary won’t be crossed
outputAppliedForce on # keep track of bias force on this variable

distance {
group1 {
atomNumbersRange 1-300
}
group2 {
atomNumbersRange 301-303
}
}
}

abf {
colvars dist

fullsamples 200
maxForce 100
}

  1. Questions 3: I have also tried to modify the example script for umbrella sampling method - peptide run from this link in github: https://github.com/CFDEMproject/LAMMPS/tree/master/examples/USER/colvars. The simulation can run, but the reference atom 37 keeps moving together with the moving atom even though I have applied centre restraint to the atom with respect to the dummy atom. I have also tried another method from github using distanceVec and apply the harmonic restraint between dummy atom and reference atom, however the reference atom 37 will still move together… How can I hold the reference atom in the fixed position?

colvar {
name d

width 0.1 # typical displacement is set to 1 Angstrom

the position restraint is enforced as a distance to a fixed point

defined by a dummy atom group.

distance {
group1 {

group definition:

atomNumbers 37

centerReference # use relative coordinates

refPositionsFile data.peptide # initial coordinates for reference group # atom 37 position 43.51012 53.02289 44.10510

refPositions (43.51012, 53.02289, 44.10510)
}
group2 {
dummyAtom (0.0, 0.0, 0.0) # fixed position
}
}
}

harmonic { # Define a moving harmonic restraint
colvars d # acting on d colvars

centers 0 # centered around zero displacement, zero RMSD, and no rotation
forceConstant 10 # unit is kcal/mol/[width]^2

where the width parameter is adapted to the dimension of each colvar

}

colvar {
name dist

width 0.1 # Spacing of grids
lowerBoundary 0.0
upperBoundary 12.0 # Determined by size of unit cell used
hardLowerBoundary yes # Inform biases that lower boundary won’t be crossed
hardUpperBoundary yes # Inform biases that upper boundary won’t be crossed
outputAppliedForce on # keep track of bias force on this variable

distance {
forceNoPBC yes
group1 {
atomNumbers 2 4 5 6
}
group2 {
atomNumbers 37
}
}
}

harmonic {
name h_pot
colvars dist
forceConstant 1.0
centers 4.0
targetCenters 12.0
targetNumStages 9
targetNumSteps 10000
outputCenters yes # Write the current centers to the trajectory file
writeTIPMF yes

outputAccumulatedWork yes # keep track of how much energy will be added

}

Thank you!

Hi Victor, part of your questions deal with the theory and practice of those methods. I highly recommend that in addition to looking at the trajectory of your specific simulation as you have done (which is a good idea), you also look at the reference papers and representative applications for each method. This is so that you can have a good understanding of the possible expected results to compare with for each method you use. Here you used steered MD, ABF and umbrella sampling, which will all give you dramatically different trajectories, even if the ultimate PMF ought to be the same for all (minus sampling errors).

  1. If I understand correctly, the molecule is initially bound at a specific position, and when you increase its relative Z coordinate, it starts diffusing along X and Y. This would be normal, and a result of being in the unbound state. Whether you use WHAM/M-BAR/etc to compute a PMF after the simulation, or use the one measured internally by thermodynamic integration, the movement along X and Y will have no effect on the PMF. If you wish, solely for visualization purposes, to confine the molecule e.g. in a cylindrical region, add a restraint on a distanceXY variable.

  2. How long is the simulation? ABF will need to “learn” the PMF around the state that you begin from, and will gradually explore other states (check the papers for details on how this works). This is done over time, and the history of the ABF simulation needs to be carried over, i.e. you need to properly restart either by giving the Colvars state file as “fix colvars input …” or use LAMMPS’s read_state.

  3. Try to avoid copy-pasting, and only add keywords that you confirm are needed for your specific case (if you don’t add a keyword explicitly, its default value is generally quite reasonable). In this case, you abused “centerReference” to fit atom 37 onto a specific position, and then computed “d” between that fixed position and the origin: therefore, “d” turned out to be a fixed number, and applying forces to it had no effect on atoms. If you want to fix atom 37, you should use its explicit position in a variable and not cancel out its movement via “centerReference”.

What I suggest in general is also not changing the collective variable’s definition while also changing the sampling method. Settle on the variable first. Starting from steered MD is usually a good approach to understand what to expect along a certain variable, and decide whether you’ll need additional (fixed) restraints. After that, you generally get better statistical convergence by switching to metadynamics, ABF, or umbrella sampling. All of these can be initialized based on snapshots from the SMD trajectory, and all can optionally be run as parallel replicas (coupled or uncoupled).

Giacomo

Hi Giacomo,

Thanks for your reply and the advice. I will look into more details of the ABF reference paper. I use Umbrella Sampling for question 1&3 cases and question 2 case (From what I read in literature, the Umbrella Sampling should be similar to SMD, but has discrete windows stages)… I believe US or SMD should be the most suitable method for me to analyse my problem.

  1. Yes, that’s what I mean… Good to know that the diffusion along the XY plane will not have any effect on PMF. I’m not really clear on how to add the restraint on distanceXY, is that I will set the axis of distanceXY as (0,0,1), and apply additional harmonic restraint to it, similar to distanceZ?

  2. The simulation time I use is the same as the question1 case, maybe because I’m just testing now, so the time I use is relatively short, I will increase the simulation time and observe again.

  3. Noted. The example script introduces me to how to apply the code, and the initial purpose is only to monitor the distance between 2 atoms at a fixed value. I will probably focus back on my case. Sorry to ask again, I’m not really clear on “use its explicit position in a variable”, does that mean in the distance variable block, I will need to remove the “centerReference” only?

Thanks again!

Regards,
Victor

Hi Victor,

Hi Giacomo,

Thanks for your reply and the advice. I will look into more details of the ABF reference paper. I use Umbrella Sampling for question 1&3 cases and question 2 case (From what I read in literature, the Umbrella Sampling should be similar to SMD, but has discrete windows stages)…

Well, not really. Umbrella sampling uses a constant bias to achieve equilibrium sampling under a modified Hamiltonian, and uses that bias to get the “real” probability distribution. To get the probability of multiple points, multiple windows may be used. SMD is by definition non-equilibrium, but will converge to umbrella sampling for infinitely slow movement. Note also that US by itself is only the method used for biasing, but to extract the PMF another method has to be used afterwards (for example, WHAM or M-BAR).

I believe US or SMD should be the most suitable method for me to analyse my problem.

  1. Yes, that’s what I mean… Good to know that the diffusion along the XY plane will not have any effect on PMF. I’m not really clear on how to add the restraint on distanceXY, is that I will set the axis of distanceXY as (0,0,1), and apply additional harmonic restraint to it, similar to distanceZ?

Yes, the restraint on distanceXY should stay fixed, but you will vary the one on distanceZ (step-wise or continuously).

  1. The simulation time I use is the same as the question1 case, maybe because I’m just testing now, so the time I use is relatively short, I will increase the simulation time and observe again.

None of the methods mentioned will give you anything meaningful in a short simulation time. ABF is advantageous because you don’t decide the direction and speed of movement ahead of time, but the method will find them according to what looks optimal (i.e. minimum amount of non-equilibrium work). If you absolutely want to see things moving just for debugging the variable SMD or US can be more useful.

  1. Noted. The example script introduces me to how to apply the code, and the initial purpose is only to monitor the distance between 2 atoms at a fixed value. I will probably focus back on my case. Sorry to ask again, I’m not really clear on “use its explicit position in a variable”, does that mean in the distance variable block, I will need to remove the “centerReference” only?

Yes, centerReference is off by default, you’d turn it on only when you want to define a different frame of reference other than the simulation cell for computing some variables.

Hi Giacomo,

!) I see… I also read from the literature that the PMF for US is always computed via WHAM or M-BAR, hence when I check from the example run for US (the US-ti folder), which the PMF is computed via WRITETIPMF command, I thought the PMF profile produced by thermodynamic integration of the mean force for US is acceptable too. In this case, is that the PMF curved produced from the command for US is not from true real probability distribution, and I should do post analysis from the output file?

Thanks for your guidance,I should try run SMD first.

Hi Victor, yes, using TI to measure the PMF in combination with a biasing restraint (moving or not) is perfectly acceptable and will work as long as (1) there is only one time-dependent bias and (2) the TI estimator is implemented for the chosen variable (in your case it is for distanceZ).

However, because this feature is unique to Colvars, the majority of published applications of US that I’ve seen rely on WHAM or M-BAR. So feel free to use the US/TI combination, but unfortunately I don’t have a reference to give you for that other than the Colvars Mol Phys paper (where I used TI in conjunction with metadynamics, not US: similar but different). Keep this fact in mind when reviewers will eventually look at your manuscript, because there are many practitioners of PMF computations, but the people who can tell the difference between an unusual combination of methods and an incorrect one are very few.

2 years ago I received a strong critique of the first submission of this paper where in one section I used overlapping windows with ABF, each with a flat-bottom restraint. The latter is standard procedure, so that the variable stays inside the window but the restraint forces don’t creep into the PMF. The reviewer was familiar with ABF, and probably also with multiple-windows ABF, but not very familiar with this crucial detail.

Another more subtle point. Since you are considering running US windows in sequence, know that when you abruptly switch the restraint from one window to the next there will be non-equilibrium forces that will contaminate your TI-based PMF. However, when using a post-processing tool such as WHAM or M-BAR you will have the opportunity to trim away the initial “equilibration” stage of the trajectory of each window. The freedom to refine the length of what you discard as “equilibration” is useful. For post-processing of the Colvars traj file, you may find this tool useful.

Giacomo

Hi Giacomo,

Noted. I will try to analyse the WHAM method again to see if there is any significant difference with this method. Thanks again for your help!

Regards,
Victor