More Efficient Way of Computing Neighbors in Range

In summary, the conversation discusses the use of MATLAB to find pairs of points within a certain range in a 3D space, with the goal of determining atomic bonds in a simulation. The speaker is unsure if using the pairs computed from the previous step would be more efficient than rerunning the rangesearch function each time. The expert suggests using a kd-tree algorithm and dividing the simulation box into small regions to search for neighboring atoms. They also mention the LAMMPS simulator and suggest checking for a similar approach.
  • #1
person123
328
52
TL;DR Summary
I'm using searchrange to locate all pairs of points within a range of one another. This is done for each step of a simulation; points move gradually from one to the next. Could I use the neighbors from the previous step to speed up computation?
Hi. I have a collection of points in 3D space. I'm using MATLAB to find all pairs of points within a certain range from one another. Right now I'm using rangesearch(X,X,r), where X is the collection of points and r is the range.

These points are the locations of atoms and I am attempting to determine atomic bonds. I am doing this for every step in a simulation. Most bonds do not change from one step to the next. Would I be able to use the pairs computed from the previous step to speed up computation for the next, as opposed to rerunning rangesearch each time? Thanks.
 
Physics news on Phys.org
  • #2
person123 said:
Would I be able to use the pairs computed from the previous step to speed up computation for the next,

I don't think so.

I am not sure what "rangesearch" does exactly but never try to compute every atom with every other atom in the simulation box. The standard way of computing a "neighbouring map" is to divide your simulation box into small regions and do a search in each small region (and also cross check with the neighbouring regions for the ones on the border.) You have to do that in each step though since atoms might be getting closer or away from each other.

You might also want to check some advanced MD simulator like LAMMPS (it is open code) to see if they implemented a clever solution using the previous step. (I doubt so though...)
 
  • #3
hacivat said:
I am not sure what "rangesearch" does exactly but never try to compute every atom with every other atom in the simulation box. The standard way of computing a "neighbouring map" is to divide your simulation box into small regions and do a search in each small region (and also cross check with the neighbouring regions for the ones on the border.)
rangesearch uses a kd-tree algorithm, which I don't fully understand, but I think works similar to the standard way you're describing.

hacivat said:
You might also want to check some advanced MD simulator like LAMMPS (it is open code) to see if they implemented a clever solution using the previous step. (I doubt so though...)
I'm actually using LAMMPS to run the simulation then analyzing the CFG files (they give me the atom coordinates at each frame) in MATLAB. I think the create_bonds command in LAMMPS does something similar. It seems to me like you would also rerun it each step and I assume it uses a similar approach.
 
  • #4
person123 said:
rangesearch uses a kd-tree algorithm
OK, just looked at the wikipedia page, that seems like an advanced thing. I doubt you will find something better. (I once had a graphene system with 5000 atoms and had to get the bonds, didn't know that algorithm, wrote my own code in python with the method I described, it was very quick in calculating actually. I only needed it once though.) The trick is to select the small regions like 2 - 2,5 Angstrom side cubes. Only slightly bigger than your expected bond length and also check with the neighbouring regions.
 

1. How does a more efficient way of computing neighbors in range benefit scientific research?

A more efficient way of computing neighbors in range can save time and resources, allowing researchers to analyze larger datasets and conduct more complex simulations. This can lead to more accurate and comprehensive findings in a shorter amount of time.

2. What methods are commonly used to compute neighbors in range?

Common methods include brute force approaches, such as using nested loops to compare each data point to all others in the dataset. Other methods include spatial indexing, which divides the dataset into smaller subsets and only compares points within a certain range.

3. How does the efficiency of computing neighbors in range impact machine learning algorithms?

In machine learning, computing neighbors in range is often used in clustering and classification algorithms. A more efficient method can greatly improve the speed and accuracy of these algorithms, leading to better predictions and insights.

4. What are some challenges in developing a more efficient way of computing neighbors in range?

One challenge is finding a balance between speed and accuracy. Some methods sacrifice accuracy for faster computation, while others may be more accurate but take longer to run. Additionally, the complexity and size of the dataset can also pose challenges in developing efficient algorithms.

5. Can a more efficient way of computing neighbors in range be applied to other fields besides scientific research?

Yes, the concept of computing neighbors in range can be applied to various fields such as data mining, image recognition, and network analysis. Any field that involves analyzing large datasets and identifying patterns can benefit from more efficient methods of computing neighbors in range.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
1K
  • Atomic and Condensed Matter
Replies
1
Views
830
  • General Math
Replies
18
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
598
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • Programming and Computer Science
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
Replies
0
Views
2K
Replies
24
Views
1K
Back
Top