core

package
v0.0.0-...-65a3d87 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2019 License: MIT Imports: 4 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func Displacement

func Displacement(a, b r3.Vector, L float64) r3.Vector

Displacement calculates the smallest vector pointing from a to b in a cell with periodic boundary conditions.

func Distance

func Distance(a, b r3.Vector, L float64) float64

Distance calculates the scalar distance between two points in a cell with periodic boundary conditions.

func InitPositionCubic

func InitPositionCubic(N int, L float64) []r3.Vector

InitPositionCubic initializes particle positions in a simple cubic configuration.

func InitPositionFCC

func InitPositionFCC(N int, L float64) []r3.Vector

InitPositionFCC initializes particle positions in a face-centered cubic configuration

func InitVelocity

func InitVelocity(N int, T0 float64, M float64) []r3.Vector

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

func PairwiseLennardJonesForce(Ri, Rj r3.Vector, L float64) r3.Vector

PairwiseLennardJonesForce calculates the force vector on particle Ri due to Rj using the Lennard Jones potential.

func PutInBox

func PutInBox(r r3.Vector, L float64) r3.Vector

PutInBox normalizes a vector to fit inside a cell with periodic boundary conditions.

Types

type ForceReturn

type ForceReturn struct {
	Index int
	F     r3.Vector
}

ForceReturn holds the index and force on a particle

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL