.. index:: pair: struct; rgpot::nlist::CellGrid .. _doxid-structrgpot_1_1nlist_1_1_cell_grid: struct rgpot::nlist::CellGrid ============================= .. toctree:: :hidden: Overview ~~~~~~~~ Cell decomposition of one configuration: atoms sorted by cell (CSR). :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include struct CellGrid { // fields std::array :target:`nc` {{1, 1, 1}}; std::array :target:`wrap` {{false, false, false}}; std::vector :ref:`start`; std::vector :ref:`atoms`; // methods long :ref:`neighbour`(int cx, int cy, int cz, const int o[3]) const; bool :ref:`build`(const double* points, std::size_t n, const double w[3], const double inv[3], double rl); }; .. _details-structrgpot_1_1nlist_1_1_cell_grid: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Cell decomposition of one configuration: atoms sorted by cell (CSR). Fields ------ .. index:: pair: variable; start .. _doxid-structrgpot_1_1nlist_1_1_cell_grid_1a616d9b2141605534a91cf1be712b58eb: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::vector start ncells + 1 row starts into ``atoms``. .. index:: pair: variable; atoms .. _doxid-structrgpot_1_1nlist_1_1_cell_grid_1a006789da87e1569d7de2744ea62f855e: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::vector atoms Atom indices grouped by cell. Methods ------- .. index:: pair: function; neighbour .. _doxid-structrgpot_1_1nlist_1_1_cell_grid_1abba1e64fa51fe4e82110c395a7f366d7: .. ref-code-block:: cpp :class: doxyrest-title-code-block long neighbour(int cx, int cy, int cz, const int o[3]) const Linear index of cell (cx, cy, cz) shifted by stencil offset ``o``, or -1 when the shift leaves a free axis. .. index:: pair: function; build .. _doxid-structrgpot_1_1nlist_1_1_cell_grid_1a8325e8f4b5bd62f82b8922074de0cca8: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool build(const double* points, std::size_t n, const double w[3], const double inv[3], double rl) Bin ``points`` into cells no narrower than ``rl``. ``w[k]`` is the periodic width and ``inv[k]`` its inverse, zero for a free axis. Returns false when a grid cannot serve (fewer than three cells along a periodic axis, or fewer than kMinCellsForGrid cells in all) or would not pay (the cell scan's pair tests for this occupancy, plus the stencil walk, above half the brute-force scan's n (n - 1) / 2: a cluster in a mostly empty box crowds a few cells), in which case the caller uses the brute-force scan.