can KDTree.NeighborSearch.list_search implement periodic boundary conditions?

135 views
Skip to first unread message

jmborr

unread,
May 30, 2012, 4:22:44 PM5/30/12
to MDnalysis discussion
AtomNeighborSearch( sel1 ).search_list( sel2, radius) returns atoms of
sel1 in contact with atoms of sel2, but can periodic boundary
conditions be passed?

Oliver Beckstein

unread,
May 30, 2012, 4:26:38 PM5/30/12
to mdnalysis-...@googlegroups.com
Hi,
No, the KDTree algorithm cannot deal with periodic boundaries.

For simple PBC (i.e. orthorhombic boxes) you can use the slower distance_array based code.

Maybe someone has a clever idea how to hack it into the KDTree code?

Oliver

--
Oliver Beckstein * orbe...@gmx.net
skype: orbeckst * orbe...@gmail.com

jmborr

unread,
May 30, 2012, 6:47:40 PM5/30/12
to MDnalysis discussion
A naive way would be to replicate the center in each neighboring cell
(26 cells) and do the search. Last, remove the duplicate contacts

indices=[]
for center in (center + center_images):
indices += kdtree.search_center_radius(center, radius)
indices = unique(indices)

I guess it'd be 27 times slower :(
> Oliver Beckstein * orbec...@gmx.net
> skype: orbeckst  * orbec...@gmail.com

Christopher Ing

unread,
Apr 4, 2013, 10:47:59 AM4/4/13
to mdnalysis-...@googlegroups.com
On this topic, I noticed some Python code for periodic KDtree on github from Patrick Varilly.

I haven't tried it yet, but it seems like something that could be useful for MDAnalysis in the future.
-Chris Ing

Oliver Beckstein

unread,
Apr 4, 2013, 12:08:45 PM4/4/13
to mdnalysis-...@googlegroups.com

On 4 Apr, 2013, at 07:47, Christopher Ing wrote:

> On this topic, I noticed some Python code for periodic KDtree on github from Patrick Varilly.
> https://github.com/patvarilly/periodic_kdtree

This does look interesting! – It would be great if anyone tried integrating it into MDAnalysis, either by adapting the existing code or by trying periodic_kdtree as a replacement of the existing KDTree.

Thanks for sharing.

— Oliver


>
> I haven't tried it yet, but it seems like something that could be useful for MDAnalysis in the future.
> -Chris Ing
>
> On Wednesday, 30 May 2012 18:47:40 UTC-4, jmborr wrote:
> A naive way would be to replicate the center in each neighboring cell
> (26 cells) and do the search. Last, remove the duplicate contacts
>
> indices=[]
> for center in (center + center_images):
> indices += kdtree.search_center_radius(center, radius)
> indices = unique(indices)
>
> I guess it'd be 27 times slower :(
>
> On May 30, 4:26 pm, Oliver Beckstein <orbec...@gmail.com> wrote:
> > Hi,
> >
> > On 30 May, 2012, at 13:22, jmborr wrote:
> >
> > > AtomNeighborSearch( sel1 ).search_list( sel2, radius) returns atoms of
> > > sel1 in contact with atoms of sel2, but can periodic boundary
> > > conditions be passed?
> >
> > No, the KDTree algorithm cannot deal with periodic boundaries.
> >
> > For simple PBC (i.e. orthorhombic boxes) you can use the slower distance_array based code.
> >
> > Maybe someone has a clever idea how to hack it into the KDTree code?
> >
> > Oliver
> >
> > --
> > Oliver Beckstein * orbec...@gmx.net
> > skype: orbeckst * orbec...@gmail.com
>
> --
> You received this message because you are subscribed to the Google Groups "MDnalysis discussion" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to mdnalysis-discus...@googlegroups.com.
> To post to this group, send email to mdnalysis-...@googlegroups.com.
> Visit this group at http://groups.google.com/group/mdnalysis-discussion?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
Reply all
Reply to author
Forward
0 new messages