Kernels

XY matrix as LazyTensors. 

Interaction kernel as LazyTensor. 

Overlapping kernel as LazyTensor. 

LazyTensor of the forces derived from the Morse potential. 

LazyTensor of the forces derived from of a quadratic potential. 
 sisyphe.kernels.squared_distances_tensor(x, y, L, boundary_conditions='periodic')
Squared distances matrix as torch Tensors.
 Parameters
x ((M,d) Tensor) – Rows.
y ((N,d) Tensor) – Columns.
L ((d,) Tensor) – Box size.
boundary_conditions (list or str, optional) –
Boundary conditions. Can be one of the following:
list of size \(d\) containing 0 (periodic) or 1 (wall with reflecting boundary conditions) for each dimension.
"open"
: no boundary conditions."periodic"
: periodic boundary conditions."spherical"
: reflecting boundary conditions on the sphere of radiusL[0]/2
and center L/2.
Default is
"periodic"
.
 Returns
The tensor whose \((i,j)\) coordinate is the squared distance between
x[i,:]
andy[j,:]
. Return type
(M,N) Tensor
 sisyphe.kernels.lazy_xy_matrix(x, y, L, boundary_conditions='periodic')
XY matrix as LazyTensors.
 Parameters
x ((M,d) Tensor) – Rows.
y ((N,d) – Columns.
L ((d,) Tensor) – Box size.
boundary_conditions (list or str, optional) –
Boundary conditions. Can be one of the following:
list of size \(d\) containing 0 (periodic) or 1 (wall with reflecting boundary conditions) for each dimension.
"open"
: no boundary conditions."periodic"
: periodic boundary conditions."spherical"
: reflecting boundary conditions on the sphere of radiusL[0]/2
and center L/2.
Default is
"periodic"
.
 Returns
The LazyTensor
A
such that for each coordinate \((i,j)\),A[i,j,:]
is the LazyTensorLazyTensor(y[j,:]x[i,:])
. Return type
(M,N,d) LazyTensor
 sisyphe.kernels.squared_distances(x, y, L, boundary_conditions='periodic')
Squared distances LazyTensor.
 Parameters
x ((M,d) Tensor) – Rows.
y ((N,d) – Columns.
L ((d,) Tensor) – Box size.
boundary_conditions (list or str, optional) –
Boundary conditions. Can be one of the following:
list of size \(d\) containing 0 (periodic) or 1 (wall with reflecting boundary conditions) for each dimension.
"open"
: no boundary conditions."periodic"
: periodic boundary conditions."spherical"
: reflecting boundary conditions on the sphere of radiusL[0]/2
and center L/2.
Default is
"periodic"
.
 Returns
The LazyTensor whose \((i,j)\) coordinate is the squared distance between
x[i,:]
andy[j,:]
. Return type
(M,N) LazyTensor
 sisyphe.kernels.sqdist_angles(x, y, x_orientation, L, boundary_conditions='periodic')
Squared distances and angles LazyTensors.
 Parameters
x ((M,d) Tensor) – Rows.
y ((N,d) – Columns.
x_orientation ((M,d) Tensor) – Orientation of x.
L ((d,) Tensor) – Box size.
boundary_conditions (list or str, optional) –
Boundary conditions. Can be one of the following:
list of size \(d\) containing 0 (periodic) or 1 (wall with reflecting boundary conditions) for each dimension.
"open"
: no boundary conditions."periodic"
: periodic boundary conditions."spherical"
: reflecting boundary conditions on the sphere of radiusL[0]/2
and center L/2.
Default is
"periodic"
.
 Returns
The LazyTensor whose \((i,j)\) coordinate is the squared distance between
x[i,:]
andy[j,:]
and the LazyTensor whose \((i,j)\) coordinate is the cosine of the angle betweeny[j,:]x[i,:]
andx_orientation[i,:]
. Return type
(M,N) LazyTensor, (M,N) LazyTensor
 sisyphe.kernels.lazy_interaction_kernel(x, y, Rx, L, boundary_conditions, vision_angle=6.283185307179586, axis=None, **kwargs)
Interaction kernel as LazyTensor.
 Parameters
x ((M,d) Tensor) – Row.
y ((N,d) Tensor) – Columns.
Rx ((N,) Tensor or float) – Interaction radius of x.
L ((d,) Tensor) – Box size.
boundary_conditions (list or str, optional) –
Boundary conditions. Can be one of the following:
list of size \(d\) containing 0 (periodic) or 1 (wall with reflecting boundary conditions) for each dimension.
"open"
: no boundary conditions."periodic"
: periodic boundary conditions."spherical"
: reflecting boundary conditions on the sphere of radiusL[0]/2
and center L/2.
Default is
"periodic"
.vision_angle (float, optional) – Angle of vision of x. Default is \(2\pi\).
axis ((M,d) Tensor, optional) – Orientation of x. Default is
None
. Must be specified if vision_angle is not \(2\pi\).**kwargs – Arbitrary keywords arguments.
 Returns
The LazyTensor whose \((i,j)\) coordinate is 1 if
y[j,:]
is in the cone of vision ofx[i,:]
and 0 otherwise. Return type
(M,N) LazyTensor
 sisyphe.kernels.lazy_overlapping_kernel(x, y, Rx, Ry, L, boundary_conditions, **kwargs)
Overlapping kernel as LazyTensor.
 Parameters
x ((M,d) Tensor) – Rows.
y ((N,d) Tensor) – Columns.
Rx ((M,) Tensor or float) – Radius of x.
Ry ((N,) Tenosr or float) – Radius of y.
L ((d,) Tensor) – Box size.
boundary_conditions (list or str, optional) –
Boundary conditions. Can be one of the following:
list of size \(d\) containing 0 (periodic) or 1 (wall with reflecting boundary conditions) for each dimension.
"open"
: no boundary conditions."periodic"
: periodic boundary conditions."spherical"
: reflecting boundary conditions on the sphere of radiusL[0]/2
and center L/2.
Default is
"periodic"
.**kwargs – Arbitrary keywords arguments.
 Returns
The LazyTensor whose \((i,j)\) coordinate is 1 if
x[i,:]
andy[j,:]
are at a distance smaller thanRx[i]+Ry[j]
(or smaller thanRx+Ry
if all the x and y particles have the same radius). Return type
(M,N) LazyTensor
 Raises
NotImplementerError – if Rx and Ry do not have the same type, or when Rx and Ry are float but Rx is not equal to Ry.
 sisyphe.kernels.lazy_morse(x, y, Ca, la, Cr, lr, p=2, mx=1.0, my=1.0, **kwargs)
LazyTensor of the forces derived from the Morse potential.
The Morse potential is defined by
\[U(z) = C_a \exp(z^p / \ell_a^p) + C_r \exp(z^p / \ell_r^p)\]The force exerted by a particle located in \(y_j\) on a particle located on \(x_i\) is
\[F =  m_x m_y \nabla U(x_i  y_j)\]where \(m_x\) and \(m_y\) are the masses of the particles in \(x_i\) and \(y_j\) respectively.
 Parameters
x ((M,d) Tensor) – Rows.
y ((N,d) Tensor) – Columns.
Ca (float) – Attraction coefficient.
la (float) – Attraction length.
Cr (float) – Repulsion coefficient.
lr (float) – Repulsion length.
p (int, optional) – Exponent. Default is 2.
mx ((M,) Tensor or float, optional) – Mass of x. Default is 1.
my ((N,) Tensor or float, optional) – Mass of y. Default is 1.
**kwargs – Arbitrary keywords arguments.
 Returns
The LazyTensor whose \((i,j,:)\) coordinate is the force exerted by
y[j,:]
onx[i,:]
derived from the Morse potential. Return type
(M,N,d) LazyTensor
 sisyphe.kernels.lazy_quadratic(x, y, R, L, boundary_conditions='periodic', **kwargs)
LazyTensor of the forces derived from of a quadratic potential.
The quadratic potential is defined by:
\[U(z) = \frac{1}{2R} z^2  z\]where \(R\) is a fixed parameter. The force exerted on a particle located on \(y_j\) on a particle located on \(x_i\) is
\[F = \left(\frac{1}{R}\frac{1}{y_jx_i}\right)(y_jx_i).\] Parameters
x ((M,d) Tensor) – Rows.
y ((N,d) Tensor) – Columns.
R ((M,) Tensor or float) – Radius of the x particles.
L ((d,) Tensor) – Box size.
boundary_conditions (list or str, optional) –
Boundary conditions. Can be one of the following:
list of size \(d\) containing 0 (periodic) or 1 (wall with reflecting boundary conditions) for each dimension.
"open"
: no boundary conditions."periodic"
: periodic boundary conditions."spherical"
: reflecting boundary conditions on the sphere of radiusL[0]/2
and center L/2.
Default is
"periodic"
.**kwargs – Arbitrary keywords arguments.
 Returns
The LazyTensor whose \((i,j,:)\) coordinate is the force exerted by
y[j,:]
onx[i,:]
derived from the quadratic potential. Return type
(M,N,d) LazyTensor