# Re: Colvar: minimal distance between 2 groups of atoms

From: Jérôme Hénin (jerome.henin_at_ibpc.fr)
Date: Mon Nov 17 2014 - 13:13:07 CST

If I may add a more general remark: if you see the need to implement some
problem-specific algorithms, this is the right time because we just
introduced changes that make the colvars interact nicely with Tcl, letting
you define variables as scripted functions of existing components, and
custom-scripted biasing algorithms.

Jerome

wrote:

> The ranges are between 2.5 and 45 Angstr ... what we can do (if colvars
> allows that) also is to update the selection and consider only those atoms
> of component 1 within 10 Angstr of component 2 ... then we'd have ranges
> between 2.5 and 10 Angstr at the beginning of PMF and between 6 and 10 at
> the end of the PMF ...
>
>
>
> On November 17, 2014 6:30:45 PM CET, "Ajasja Ljubetič" <
> ajasja.ljubetic_at_gmail.com> wrote:
>>
>> Hmm, but what is the width of distributions in each separate component?
>> If you have the distances between atoms of the groups in the range of
>> (2.5,40) then n=10^7 will get you to 2.563 A
>> (and you will probably need the exponential weighting).
>> If on the other hand you have distances on the (40, 42.5) the n=10^5 will
>> get you to 40.004 A.
>>
>> Best regards,
>> Ajasja
>>
>> Disclaimer: These are only back of the envelope calculations done as a
>> break from writing my PhD:) I have no previous experience with
>> distanceInv.
>>
>> On 17 November 2014 17:49, Vlad Cojocaru <
>>
>>> Thanks a lot ...
>>>
>>> Our distances are between a few Angstr (e.g. 2.5) and a few tens of
>>> Angstr (e.g 40) between a 2 component system. For the dissociation PMF
>>> calculation we'd need a resolution of 0.05 Angstr (center of the PMF window
>>> would change by 0.05 Angstr minimal distance) ...
>>>
>>> Basically. we are doing the types of simulations described by Bouvier
>>> and Lavery (http://pubs.acs.org/doi/abs/10.1021/ja901761a) and we are
>>> looking for an alternative to the original code (a mixture of tcl forces
>>> and C code implemented for NAMD) because we encountered some RATTLE-related
>>> problems when using it with our systems as well performance limitations
>>> (especially scaling) ...
>>>
>>> Best
>>>
>>>
>>>
>>>
>>> On 11/17/2014 05:28 PM, Ajasja Ljubetič wrote:
>>>
>>> Here is a quick plot of inverse distance versus n for a uniform
>>> distribution on the interval (1,2). As you can see, with increasing n the
>>> value of the distance approximates the minimum distance.
>>>
>>> [image: Inline images 1]
>>>
>>> If your distances are large, you may have to set n to large values.
>>> So barring any precision issues this approach should work.
>>>
>>> For example for values in the range of (100,101) with n=10000
>>> [image: Inline images 2]
>>>
>>> Good luck & best regards,
>>> Ajasja
>>>
>>> On 17 November 2014 17:14, Vlad Cojocaru <
>>>
>>>> Below is how PLUMED implements the minimal distance and this looks
>>>> more in the direction you mention ..... The problem with PLUMED is that in
>>>> apparently does not allow NPT simulations with NAMD ... I also don't know
>>>> how PMF calculations with PLUMED versus COLVAR scale with NAMD
>>>>
>>>> http://plumed.github.io/doc-v2.0/user-doc/html/mindist.html
>>>>
>>>> Best
>>>>
>>>>
>>>>
>>>> On 11/17/2014 05:07 PM, Jérôme Hénin wrote:
>>>>
>>>> Indeed, but the larger the negative exponent, the more this average is
>>>> skewed towards the smallest distances in the set, making it a possible
>>>> approximation to the minimal distance. If that is not steep enough, the
>>>> power function can be replaced with an exponential, but it's still a form
>>>> of average. By the way, that would be really easy to implement if there is
>>>> demand for it.
>>>>
>>>> Jerome
>>>>
>>>> On 17 November 2014 16:57, Vlad Cojocaru <
>>>>
>>>>> But this looks more like an average distance than a minimum distance,
>>>>> isn't it ?
>>>>>
>>>>>
>>>>>
>>>>> On 11/17/2014 03:49 PM, Giacomo Fiorin wrote:
>>>>>
>>>>> Can you try distanceInv choosing the exponent that gives you the best
>>>>> behavior?
>>>>> On Nov 17, 2014 8:42 AM, "Vlad Cojocaru" <
>>>>>
>>>>>> Dear NAMD users,
>>>>>>
>>>>>> Could you please let me know if it is currently possible to define
>>>>>> the minimal distance between 2 groups of atoms as a colvar component within
>>>>>> the colvar module ?
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>> Best wishes
>>>>>>
>>>>>> --
>>>>>> Computational Structural Biology Laboratory
>>>>>> Department of Cell and Developmental Biology
>>>>>> Max Planck Institute for Molecular Biomedicine
>>>>>> Röntgenstrasse 20, 48149 Münster, Germany
>>>>>> Tel: +49-251-70365-324; Fax: +49-251-70365-399
>>>>>> http://www.mpi-muenster.mpg.de/research/teams/groups/rgcojocaru
>>>>>>
>>>>>>
>>>>> --
>>>>> Computational Structural Biology Laboratory
>>>>> Department of Cell and Developmental Biology
>>>>> Max Planck Institute for Molecular Biomedicine
>>>>> Röntgenstrasse 20, 48149 Münster, Germany
>>>>> Tel: +49-251-70365-324; Fax: +49-251-70365-399
>>>>>
>>>>>
>>>>
>>>> --
>>>> Computational Structural Biology Laboratory
>>>> Department of Cell and Developmental Biology
>>>> Max Planck Institute for Molecular Biomedicine
>>>> Röntgenstrasse 20, 48149 Münster, Germany
>>>> Tel: +49-251-70365-324; Fax: +49-251-70365-399
>>>>
>>>>
>>>
>>> --
>>> Computational Structural Biology Laboratory
>>> Department of Cell and Developmental Biology
>>> Max Planck Institute for Molecular Biomedicine
>>> Röntgenstrasse 20, 48149 Münster, Germany
>>> Tel: +49-251-70365-324; Fax: +49-251-70365-399