# Re: Umbrella sampling colvars DistanceZ deviates a lot

From: Giacomo Fiorin (giacomo.fiorin_at_gmail.com)
Date: Wed Sep 14 2016 - 08:32:43 CDT

Whether or not you are using a dihedral or a "simple" distance, you are
always computing distances between COMs of individual atoms, and although
the distance follows the minimum-image convention, the COM calculation
doesn't.

There is a specific section "Treatment of periodic boundary conditions." in
the manual regarding this:
http://colvars.github.io/colvars-refman-namd/colvars-refman-namd.html

Giacomo

On Wed, Sep 14, 2016 at 12:10 AM, Kevin C Chan <cchan2242-c_at_my.cityu.edu.hk>
wrote:

> Fiorin,
> So how could we explain the first few lines of colvars.traj are all
> deviated values? Shouldn't they be unwrapped already during the run? Even
> if it measure 63.3 from a wrapped coor, it could never measure another 63.3
> from a unwrapped one. So what was it coupling?
> In fact, you raised a very good point. I have reported previously problems
> with colvars when calculating dihedrals with restarted NAMD auto-wrapping
> turned on. I just did not aware it could also be the problem with simple
> distance calculations.
> Thanks anyway.
>
> Ray,
> Thank you for the reminding. I thought "ForceNoPBC yes" would help the PBC
> problem.
>
>
> Many more thanks if other colvars contributors could share your experience!
>
> Regards,
> Kevin
>
> On Wed, Sep 14, 2016 at 4:22 AM, Sourav Ray <souravray90_at_gmail.com> wrote:
>
>> Hello
>>
>> If I may add, it is better to keep the box size large (to accommodate the
>> variation in colvar) and specify an upper boundary (in case it can be
>> determined) to get reasonable results, else the periodic conditions will
>> result in large fluctuations in the output generated.
>>
>> Regards
>> Sourav
>>
>>
>> On Wed, Sep 14, 2016 at 1:46 AM, Giacomo Fiorin <giacomo.fiorin_at_gmail.com
>> > wrote:
>>
>>> Hi Kevin, the wrapping is only done in the file, not in the memory
>>> during a run. Thus, any wrapping issue would only arise when the restart
>>> file is read by the next run.
>>>
>>> On Tue, Sep 13, 2016 at 1:27 PM, Tabris Chun Chan <
>>> cchan2242-c_at_my.cityu.edu.hk> wrote:
>>>
>>>> Hi Fiorin, thank you for the hints. However, I am wondering if it is
>>>> the case, shouldn't colvars meaure the value after NAMD unwrapping the
>>>> restart coordinates? If it is really reading a wrapped value, what will
>>>> happen when it couples a wrapped value to the window center during a
>>>> unwrapped run? Hard to imagine.
>>>>
>>>> Many thanks!
>>>>
>>>> Regards,
>>>> Kevin
>>>>
>>>>
>>>> On 14 Sep 2016, 00:24 +0800, Giacomo Fiorin <giacomo.fiorin_at_gmail.com>,
>>>> wrote:
>>>>
>>>> Hello Kevin, try looking into possible PBC wrapping issues.
>>>> Coordinates are internally unwrapped during a run, but get wrapped when an
>>>> output file (such as a restart is written) and this will affect the next
>>>> run.
>>>>
>>>>
>>>>
>>>> On Tue, Sep 13, 2016 at 12:19 PM, Kevin C Chan <
>>>> cchan2242-c_at_my.cityu.edu.hk> wrote:
>>>>
>>>>> Dear Users,
>>>>>
>>>>> I am doing umbrella sampling in NAMD with the colvars function. I have
>>>>> specify a colvars file like this:
>>>>> colvarsTrajFrequency 20
>>>>> colvarsRestartFrequency 1000
>>>>>
>>>>> colvar {
>>>>> name ProjectionZ
>>>>>
>>>>> width 1.0
>>>>>
>>>>> distanceZ {
>>>>> main {
>>>>> atomsFile ../main.pdb
>>>>> atomsCol B
>>>>> atomsColValue 1.0
>>>>> }
>>>>> ref {
>>>>> atomsFile ../ref.pdb
>>>>> atomsCol B
>>>>> atomsColValue 1.0
>>>>> }
>>>>> forceNoPBC yes
>>>>> }
>>>>> }
>>>>>
>>>>> harmonic {
>>>>> colvars ProjectionZ
>>>>> centers 59.5
>>>>> forceConstant 4.0
>>>>> }
>>>>>
>>>>> Pretty standard. The first three lines of colvars.traj reads:
>>>>> 0 5.96855721722479e+01
>>>>> 20 5.96916027979287e+01
>>>>> 40 5.96942978400560e+01
>>>>> Pretty close. The last three lines of colvars.traj reads:
>>>>> 499940 5.91646234042935e+01
>>>>> 499960 5.91735242021637e+01
>>>>> 499980 5.91815463732824e+01
>>>>> Also close. Good. However, strange things happen when I restart the
>>>>> simulation over and over again from restart.coor, restart.vel and
>>>>> restart.xsc files.
>>>>> After a few times (~70) of restarts. While the last three lines of
>>>>> 606960 5.95480754008586e+01
>>>>> 606980 5.95456901525873e+01
>>>>> 607000 5.95617980942163e+01
>>>>> The first three lines of the next colvars.traj reads:
>>>>> 0 6.33546567861433e+01
>>>>> 20 6.33540970478523e+01
>>>>> 40 6.33519859940328e+01
>>>>> which was pretty far away from what I want. Then I can see the colvars
>>>>> shifting the value towards 5.95. Then for the next colvars.traj:
>>>>> 0 4.86674663226018e+01
>>>>> 20 4.86540561800189e+01
>>>>> 40 4.86566065988872e+01
>>>>>
>>>>> There seems to have something wrong with restarting simulations with
>>>>> colvars turned on. Anyone has experience on this?
>>>>>
>>>>>
>>>>> Regards,
>>>>> Kevin
>>>>> City University of Hong Kong
>>>>> ukevi_at_gmx.hk
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Giacomo Fiorin
>>>> Associate Professor of Research
>>>> Institute for Computational Molecular Science (ICMS)
>>>> College of Science and Technology, Temple University
>>>> 1925 North 12th Street (035-07), Room 704D
>>>> Phone: +1-215-204-4213
>>>>
>>>> Scholar: http://goo.gl/Q3TBQU
>>>> Personal: http://giacomofiorin.github.io/
>>>> Lab page: https://icms.cst.temple.edu/members.html
>>>>
>>>> *"As computer programmers we have a responsibility to make sure that we
>>>> run the computers instead of the computers running us."* - Steve
>>>> Oualline
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Giacomo Fiorin
>>> Associate Professor of Research
>>> Institute for Computational Molecular Science (ICMS)
>>> College of Science and Technology, Temple University
>>> 1925 North 12th Street (035-07), Room 704D
>>> Phone: +1-215-204-4213
>>>
>>> Scholar: http://goo.gl/Q3TBQU
>>> Personal: http://giacomofiorin.github.io/
>>> Lab page: https://icms.cst.temple.edu/members.html
>>>
>>> *"As computer programmers we have a responsibility to make sure that we
>>> run the computers instead of the computers running us."* - Steve
>>> Oualline
>>>
>>>
>>>
>>
>

```--
Giacomo Fiorin
Associate Professor of Research
Institute for Computational Molecular Science (ICMS)
College of Science and Technology, Temple University
1925 North 12th Street (035-07), Room 704D