xnn.ffnn.models.amoeba.StepPlan#
- class xnn.ffnn.models.amoeba.StepPlan(skin=0.0, capacity=None)[source]#
Bases:
objectWhat an evaluation of a structure decides on the host, recorded once and reused while the structure moves by small steps (molecular dynamics between rebuilds of the pair list): the image shifts of every bonded vector, the unique pairs of the neighbor list with their image shifts and scale factors, the layout of the Ewald sums and the polarizable atoms. An evaluation on a plan reads these instead of deciding them, so it waits for the device only in the convergence tests of the induced-dipole solve.
The pairs form a Verlet list: built with a neighbor list of
cutoff + skin, they hold every pair within the cutoff until an atom has moved by more than half the skin (outdated()); the pairs beyond the cutoff and the padding up to a fixed capacity get zero weight.solve_iterations, a dict from"forward"and"adjoint"to a number of iterations, makes those solves run exactly that long without reading the device (the counts of earlier steps are insolver_stats);convergedthen tells on the device whether every solve of the last evaluation and its backward pass converged, andneededholds, per phase in the order ofSOLVE_PHASES, the iterations the last solve of that phase needed (zero for a phase that did not run). Build a plan withAmoeba.plan_step().termsselects the terms an evaluation on the plan computes, for multiple time step integrators:"all"(default),"valence"(the bonded terms and the reference energies, without pairs, multipoles or solves) or"nonbonded"(the rest, the induction included). The two subsets add up to the whole energy, forces and stress. A valence evaluation follows atoms wrapped back into the cell since the pairs were found by whole lattice vectors, so it needs no check of the positions.- outdated(pos)[source]#
Whether an atom at
poshas moved by more than half the skin since the plan was built, as a boolean on the device (the pair list then misses pairs and the plan must be built again).- Parameters:
pos (Tensor) – Positions
(N, 3).- Returns:
A boolean scalar.
- Return type:
Tensor
- due(pos, last, steps=1)[source]#
Whether an atom at
poswill have moved by more than half the skin afterstepsmore steps like the one fromlast, with one step to spare, as a boolean on the device: the pair list is still valid now and should be built again withinstepssteps.- Parameters:
pos (Tensor) – Positions
(N, 3).last (Tensor) – The positions of the step before
(N, 3).steps (int, optional) – The steps the pair list must still hold, by default 1 (it is built again before the next step).
- Returns:
A boolean scalar.
- Return type:
Tensor
- checks(pos, last, steps=1)[source]#
outdated()anddue()ofposwith the solves’ convergence and needed iterations, as one float64 tensor[outdated, due, converged, *needed], andlastset toposafter: one kernel on a GPU, so a recorded CUDA graph ends a step with one launch and its caller reads everything at once.