Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Re-allocating neighbour list if it overflows. #33

Merged

Conversation

AlexanderMath
Copy link

@AlexanderMath AlexanderMath commented Jan 5, 2025

Changing code to re-allocate neighbours instead of throwing RuntimeError('Spatial overflow.') as per discussion here.

Changes relative to discussion

  1. Changed print(..) to logging.msg('Re-allocating neighbours. ')
  2. Copied code in both calculator_sparse.py and calculator.py - LMK if that doesn't make any sense.
# before
if neighbors.overflow:
   RuntimeError('Spatial overflow.')
   
# new 
if neighbors.overflow:
  self.neighbors, self.spatial_partitioning = neighbor_list(positions=R,
                                                                      cell=cell,
                                                                      cutoff=self.cutoff,
                                                                      skin=0.,
                                                                      capacity_multiplier=self.capacity_multiplier)
            logging.mlff('Re-allocating neighbours. ') 
            neighbors = self.spatial_partitioning.update_fn(R, self.neighbors)
            assert not neighbors.overflow
            self.neighbors = neighbors

@AlexanderMath AlexanderMath changed the title Re-allocating neighbour list if it overflos. Re-allocating neighbour list if it overflows. Jan 5, 2025
@thorben-frank thorben-frank merged commit 0b929bd into thorben-frank:v1.0-lrs-gems Jan 13, 2025
@thorben-frank
Copy link
Owner

thank you for your contribution @AlexanderMath :-) LGTM!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants