<commit_before>package sim

import (
	"github.com/quells/LennardJones/space"
	"github.com/quells/LennardJones/vector"
	"math"
)

// PairwiseLennardJonesPotential calculates the Lennard Jones potential between two positions.
func PairwiseLennardJonesPotential(Ri, Rj [3]float64, L float64) float64 {
	r := space.Distance(Ri, Rj, L)
	return 4 * (math.Pow(r, -12) - math.Pow(r, -6))
}

// KineticEnergy calculates the kinetic energy of a particle.
func KineticEnergy(v [3]float64, m float64) float64 {
	s := vector.Length(v)
	return 0.5 * m * s * s
}

// TotalKineticEnergy calculates the kinetic energy of all particles in the system.
func TotalKineticEnergy(V [][3]float64, m float64) (sum float64) {
	for _, v := range V {
		sum += KineticEnergy(v, m)
	}
	return
}

// Temperature calculates the temperature of the system from the average kinetic energy of the particles.
func Temperature(V [][3]float64, m float64, N int) float64 {
	return TotalKineticEnergy(V, m) * 2 / 3 / float64(N)<commit_msg>Update energy.go<commit_after>package sim

import (
	"github.com/quells/LennardJonesGo/space"
	"github.com/quells/LennardJonesGo/vector"
	"math"
)

// PairwiseLennardJonesPotential calculates the Lennard Jones potential between two positions.
func PairwiseLennardJonesPotential(Ri, Rj [3]float64, L float64) float64 {
	r := space.Distance(Ri, Rj, L)
	return 4 * (math.Pow(r, -12) - math.Pow(r, -6))
}

// KineticEnergy calculates the kinetic energy of a particle.
func KineticEnergy(v [3]float64, m float64) float64 {
	s := vector.Length(v)
	return 0.5 * m * s * s
}

// TotalKineticEnergy calculates the kinetic energy of all particles in the system.
func TotalKineticEnergy(V [][3]float64, m float64) (sum float64) {
	for _, v := range V {
		sum += KineticEnergy(v, m)
	}
	return
}

// Temperature calculates the temperature of the system from the average kinetic energy of the particles.
func Temperature(V [][3]float64, m float64, N int) float64 {
	return TotalKineticEnergy(V, m) * 2 / 3 / float64(N)
{'fraction_non_alphanumeric': 0.11432850723914129, 'fraction_numerical': 0.03794308537194209, 'mean_word_length': 4.430894308943089, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3655590', 'n_tokens_mistral': 800, 'n_tokens_neox': 686, 'n_words': 216}