Package org.opensourcephysics.numerics
Class PBC
java.lang.Object
org.opensourcephysics.numerics.PBC
Implements methods to support periodic boundary condtions.
- Author:
- W. Christian
-
Method Summary
Modifier and TypeMethodDescriptionstatic doubleposition(double r, double size) Adjusts the postion of a particle assuming peridoic boundary conditions.static intposition(int r, int size) Adjusts the postion of a particle assuming peridoic boundary conditions.static doubleseparation(double dr, double size) Computes the minimum separation using periodic boundary conditions.static intseparation(int dr, int size) Computes the minimum separation using periodic boundary conditions.
-
Method Details
-
position
public static double position(double r, double size) Adjusts the postion of a particle assuming peridoic boundary conditions. The postion will be in the interval [0,size).- Parameters:
r- doublesize- double- Returns:
- double
-
position
public static int position(int r, int size) Adjusts the postion of a particle assuming peridoic boundary conditions. The postion will be in the interval [0,size).- Parameters:
r- intsize- int- Returns:
- int
-
separation
public static double separation(double dr, double size) Computes the minimum separation using periodic boundary conditions.- Parameters:
dr- double the separationsize- double the box size- Returns:
- double
-
separation
public static int separation(int dr, int size) Computes the minimum separation using periodic boundary conditions.- Parameters:
dr- int the separationsize- int the box size- Returns:
- int
-