Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lmiq committed Nov 26, 2022
1 parent 719afcd commit e10ce90
Showing 1 changed file with 30 additions and 8 deletions.
38 changes: 30 additions & 8 deletions docs/src/PeriodicSystems.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,6 @@ const masses = # ... some masses
u = map_pairwise((x,y,i,j,d2,u) -> energy(d2,u,masses), system)
```

To compute a different property from the same coordinates and cell lists, use `preserve_lists=true`, for example,
```julia
u = map_pairwise((x,y,i,j,d2,u) -> u += sqrt(d2), system; preserve_lists = true)
```
in which case we are computing the sum of distances from the same cell lists used to compute the energy in the previous example
(requires version 0.8.7). Specifically, this will skip the updating of the cell lists, thus be careful to not use this
option if the cutoff, unitcell, or any other property of the system changed.

## Potential energy example

!!! note
Expand Down Expand Up @@ -589,6 +581,36 @@ inhomogeneous systems increasing the number of batches of the mapping phase (sec
parameter of the tuple) may improve the performance by reducing the idle time of
threads.

### Preserving the cell lists

To compute a different property from the same coordinates and cell lists, use `preserve_lists=true`, for example,
```julia
using CellListMap.PeriodicSystems, StaticArrays
system = PeriodicSystem(xpositions=rand(SVector{3,Float64},1000), output=0.0, cutoff=0.1, unitcell=[1,1,1])
map_pairwise((x,y,i,j,d2,u) -> u += d2, system)
# Second run: preserve the cell lists but compute a different property
map_pairwise((x,y,i,j,d2,u) -> u += sqrt(d2), system; preserve_lists = true)
```
in which case we are computing the sum of distances from the same cell lists used to compute the energy in the previous example
(requires version 0.8.8). Specifically, this will skip the updating of the cell lists, thus be careful to not use this
option if the cutoff, unitcell, or any other property of the system changed.

For systems with two sets of particles, the
coordinates of the `xpositions` set can be updated, preserving the cell lists computed for the `ypositions`, but this requires
setting `autoswap=false` in the construction of the `PeriodicSystem`:
```julia
using CellListMap.PeriodicSystems, StaticArrays
system = PeriodicSystem(
xpositions=rand(SVector{3,Float64},1000),
ypositions=rand(SVector{3,Float64},2000),
output=0.0, cutoff=0.1, unitcell=[1,1,1],
autoswap=false # Cell lists are constructred for ypositions
)
map_pairwise((x,y,i,j,d2,u) -> u += d2, system)
# Second run: preserve the cell lists but compute a different property
map_pairwise((x,y,i,j,d2,u) -> u += sqrt(d2), system; preserve_lists = true)
```

### Control CellList cell size

The cell sizes of the construction of the cell lists can be controled with the keyword `lcell`
Expand Down

2 comments on commit e10ce90

@lmiq
Copy link
Member Author

@lmiq lmiq commented on e10ce90 Nov 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/72922

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.8.8 -m "<description of version>" e10ce90502e9db3dbd8da10f49e8ae1822a879c6
git push origin v0.8.8

Please sign in to comment.