<commit_before>/**
 * Checks if n is a number or not.
 * @param n: Input
 * @returns {boolean}
 */
var isNumber = function (n) {
    return isFinite(n) && +n === n;
};

/**
 * Lennard-Jones potential class.
 * @param sigma: Radius where potential is 0.
 * @param epsilon: Potential at equilibrium distance.
 * @constructor
 */
LJ = function (sigma, epsilon) {

    // Sanity check.
    if (!isNumber(sigma) || !isNumber(epsilon)) {
        console.error("Error! Sigma and Epsilon values invalid!");
    }

    // LJ parameters initialisation.
    this.s = sigma;
    this.e = epsilon;
};

LJ.prototype.add = function (sigma,epsilon) {
    this.s = (this.s + sigma)/2;
    this.e = Math.sqrt(this.e * epsilon);
};

/**
 * Calculate LJ potential.
 * @param r: Distance from LJ centre.
 * @returns {number|*}
 */
LJ.prototype.calcV = function(r) {
    var repulsive = Math.pow(this.s / r, 12);                   // Repulsive factors.
    var attractive = -1 * Math.pow(this.s / r, 6);              // Attractive factors.
    return 4 * this.e * (repulsive + attractive);     // Calculating LJ potential at distance r.
};

LJ.prototype.calcF = function(r) {
    var repulsive = -12 * Math.pow(this.s / r, 11);
    var attractive = 6 * Math.pow(this.s / r, 6);
    return 4 * this.e * (repulsive + attractive)
};
LJ.prototype.getR_0 = function(){
    return Math.pow(2,-1/6) * this.s;
};



/**
 * Harmonic potential class.
 * @param equilibrium: Equilibrium distance of pair of atoms.
 * @param force_constant: Hooke's Law, spring/force constant.
 * @constructor
 */
Parabolic = function (equilibrium, force_constant) {

    // Sanity check.<commit_msg>Fixed force calculation<commit_after>/**
 * Checks if n is a number or not.
 * @param n: Input
 * @returns {boolean}
 */
var isNumber = function (n) {
    return isFinite(n) && +n === n;
};

/**
 * Lennard-Jones potential class.
 * @param sigma: Radius where potential is 0.
 * @param epsilon: Potential at equilibrium distance.
 * @constructor
 */
LJ = function (sigma, epsilon) {

    // Sanity check.
    if (!isNumber(sigma) || !isNumber(epsilon)) {
        console.error("Error! Sigma and Epsilon values invalid!");
    }

    // LJ parameters initialisation.
    this.s = sigma;
    this.e = epsilon;
};

LJ.prototype.add = function (sigma,epsilon) {
    this.s = (this.s + sigma)/2;
    this.e = Math.sqrt(this.e * epsilon);
};

/**
 * Calculate LJ potential.
 * @param r: Distance from LJ centre.
 * @returns {number|*}
 */
LJ.prototype.calcV = function(r) {
    var repulsive = Math.pow(this.s / r, 12);                   // Repulsive factors.
    var attractive = -1 * Math.pow(this.s / r, 6);              // Attractive factors.
    return 4 * this.e * (repulsive + attractive);     // Calculating LJ potential at distance r.
};

LJ.prototype.calcF = function(r) {
    var repulsive = -12 * Math.pow(this.s / r, 12);
    var attractive = 6 * Math.pow(this.s / r, 6);
    return 4 * this.e * (repulsive + attractive)/r;
};

LJ.prototype.getR_0 = function(){
    return Math.pow(2,-1/6) * this.s;
};



/**
 * Harmonic potential class.
 * @param equilibrium: Equilibrium distance of pair of atoms.
 * @param force_constant: Hooke's Law, spring/force constant.
 * @constructor
 */
Parabolic = function (equilibrium, force_constant) {

    // Sanity check.
{'fraction_non_alphanumeric': 0.15217391304347827, 'fraction_numerical': 0.010869565217391304, 'mean_word_length': 2.7099664053751398, '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': '6813844', 'n_tokens_mistral': 1149, 'n_tokens_neox': 1074, 'n_words': 315}