Documentation ¶
Overview ¶
Package sim implements molecular dynamics simulation. The current implementation uses a Lennard Jones potential, but is generalizable to other potentials.
Package space implements utilities to do vector math with periodic boundary conditions.
Index ¶
- func Displacement(a, b r3.Vector, L float64) r3.Vector
- func Distance(a, b r3.Vector, L float64) float64
- func InitPositionCubic(N int, L float64) []r3.Vector
- func InitPositionFCC(N int, L float64) []r3.Vector
- func InitVelocity(N int, T0 float64, M float64) []r3.Vector
- func InternalForce(i int, R []r3.Vector, L float64, c chan ForceReturn)
- func PairwiseLennardJonesForce(Ri, Rj r3.Vector, L float64) r3.Vector
- func PutInBox(r r3.Vector, L float64) r3.Vector
- type ForceReturn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Displacement ¶
Displacement calculates the smallest vector pointing from a to b in a cell with periodic boundary conditions.
func Distance ¶
Distance calculates the scalar distance between two points in a cell with periodic boundary conditions.
func InitPositionCubic ¶
InitPositionCubic initializes particle positions in a simple cubic configuration.
func InitPositionFCC ¶
InitPositionFCC initializes particle positions in a face-centered cubic configuration
func InitVelocity ¶
InitVelocity initializes particle velocities selected from a random distribution. Ensures that the net momentum of the system is zero and scales the average kinetic energy to match a given temperature.
func InternalForce ¶
func InternalForce(i int, R []r3.Vector, L float64, c chan ForceReturn)
InternalForce calculates the total force vector on particle Ri due to the other particles in R due to a pairwise force.
func PairwiseLennardJonesForce ¶
PairwiseLennardJonesForce calculates the force vector on particle Ri due to Rj using the Lennard Jones potential.
Types ¶
type ForceReturn ¶
ForceReturn holds the index and force on a particle