<commit_before>#include "interactions.hpp"

#include <cmath>

#include "globals.hpp"
#include "vectors.hpp"

void LJInteraction::eval(const vector<Vec3d>& positions, vector<Vec3d>& forces, vector<double>& energies) const {
    Vec3d r_vec = positions[atom_i1_] - positions[atom_i2_];
    double r_sqr = r_vec.lensqr();
    double r6 = r_sqr * r_sqr * r_sqr;
    double term_a = es12_ / (r6*r6);
    double term_b = es6_ / r6;
    double e = term_a - term_b;
    Vec3d f = (12*term_a - 6*term_b) / r_sqr * r_vec;
    energies[atom_i1_] += e;
    energies[atom_i2_] += e;
    forces[atom_i1_] += f;
    forces[atom_i2_] -= f;
}

void MorseInteraction::eval(const vector<Vec3d>& positions, vector<Vec3d>& forces, vector<double>& energies) const {
    Vec3d r_vec = positions[atom_i1_] - positions[atom_i2_];
    double r = r_vec.len();
    double d_exp = exp(- a_ * (r - re_));
    double e = de_ * (pow(d_exp, 2) - 2 * d_exp + 1);
    double f_abs = 2 * de_ * a_ * (pow(d_exp, 2) - d_exp);
    Vec3d f = f_abs * r_vec.normalized();
    energies[atom_i1_] += e;
    energies[atom_i2_] += e;
    forces[atom_i1_] += f;
    forces[atom_i2_] -= f;
}

void CoulombInteraction::eval(const vector<Vec3d>& positions, vector<Vec3d>& forces, vector<double>& energies) const {
    Vec3d r_vec = positions[atom_i1_] - positions[atom_i2_];
    double r = r_vec.len();
    double e = qq_ / r;
    Vec3d f = qq_ / (r*r*r) * r_vec;
    energies[atom_i1_] += e;
    energies[atom_i2_] += e;
    forces[atom_i1_] += f;
    forces[atom_i2_] -= f;
}<commit_msg>Removed unnecessary normalisation.<commit_after>#include "interactions.hpp"

#include <cmath>

#include "globals.hpp"
#include "vectors.hpp"

void LJInteraction::eval(const vector<Vec3d>& positions, vector<Vec3d>& forces, vector<double>& energies) const {
    Vec3d r_vec = positions[atom_i1_] - positions[atom_i2_];
    double r_sqr = r_vec.lensqr();
    double r6 = r_sqr * r_sqr * r_sqr;
    double term_a = es12_ / (r6*r6);
    double term_b = es6_ / r6;
    double e = term_a - term_b;
    Vec3d f = (12*term_a - 6*term_b) / r_sqr * r_vec;
    energies[atom_i1_] += e;
    energies[atom_i2_] += e;
    forces[atom_i1_] += f;
    forces[atom_i2_] -= f;
}

void MorseInteraction::eval(const vector<Vec3d>& positions, vector<Vec3d>& forces, vector<double>& energies) const {
    Vec3d r_vec = positions[atom_i1_] - positions[atom_i2_];
    double r = r_vec.len();
    double d_exp = exp(- a_ * (r - re_));
    double e = de_ * (pow(d_exp, 2) - 2 * d_exp + 1);
    double f_abs = 2 * de_ * a_ * (pow(d_exp, 2) - d_exp);
    Vec3d f = f_abs / r * r_vec;
    energies[atom_i1_] += e;
    energies[atom_i2_] += e;
    forces[atom_i1_] += f;
    forces[atom_i2_] -= f;
}

void CoulombInteraction::eval(const vector<Vec3d>& positions, vector<Vec3d>& forces, vector<double>& energies) const {
    Vec3d r_vec = positions[atom_i1_] - positions[atom_i2_];
    double r = r_vec.len();
    double e = qq_ / r;
    Vec3d f = qq_ / (r*r*r) * r_vec;
    energies[atom_i1_] += e;
    energies[atom_i2_] += e;
    forces[atom_i1_] += f;
    forces[atom_i2_] -= f;
}
{'fraction_non_alphanumeric': 0.15372168284789645, 'fraction_numerical': 0.02912621359223301, 'mean_word_length': 3.479710144927536, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, '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': '3266069', 'n_tokens_mistral': 1318, 'n_tokens_neox': 1312, 'n_words': 279}