<commit_before>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */


package etomica.potential;
import etomica.atom.IAtomList;
import etomica.box.Box;
import etomica.space.Space;
import etomica.units.Kelvin;
import etomica.util.Constants;

/**
 * Simplified pair potential for Helium.  The potential has the form of an
 * exponential-6 model with an additional r^-10 term.
 *
 * @author <NAME>
 */
public class P2HeSimplified extends Potential2SoftSpherical {
    
    public P2HeSimplified(Space space) {
        super(space);
    }

    /**
     * The energy u.
     */
    public double u(double r2) {

    	if (r2 < sigmaHC2) {
    		return Double.POSITIVE_INFINITY;
    	}

    	double r = Math.sqrt(r2);
        double r4 = r2*r2;
        double r6 = r4*r2;
        double r8 = r4*r4;
        double r10 = r6*r4;
        return A0*Math.exp(-A1*r)-A2/r6-A3/(useC10 ? r10 : r8);
    }

    /**
     * The derivative r*du/dr.
     */
    public double du(double r2) {
        double r = Math.sqrt(r2);
        double r4 = r2*r2;
        double r6 = r4*r2;
        double r8 = r4*r4;
        double r10 = r6*r4;
        return -A0*A1*Math.exp(-A1*r)*r + 6*A2/(r6) + A3*(useC10? 10/r10 : 8/r8);
    }

   /**
    * The second derivative of the pair energy, times the square of the
    * separation:  r^2 d^2u/dr^2.
    */
    public double d2u(double r2) {
        double r = Math.sqrt(r2);
        double r4 = r2*r2;
        double r6 = r4*r2;
        double r8 = r4*r4;
        double r10 = r6*r4;
        return A0*A1*A1*Math.exp(-A1*r)*r2 - 42*A2/(r6) - A3*(useC10? 110/r10 : 72/r8);
    }
            
    /**
     *  Integral used for corrections to potential truncation.
     */
    public double uInt(double rC) {
        return 0;
    }

    public P2HeQFH makeQFH(double temperature) {
        return this.new P2HeQFH(temperature);
    }

    /**
     * This inner class can calculates the Feynman-Hibbs semiclassical
     * approximation for the potential.  Results should be the same as using
     * P2EffectiveFeynmanHibbs, but should be faster, because u, du and d2u
     * are not called.  Much of the work is duplicated between those methods,
     * and they are all computed at the same time in this class.
     * 
     * This class is only ~10% slower than the classical potential.
     *
     * @author <NAME>
     */
    public class P2HeQFH implements Potential2Spherical {

        protected final double temperature;
        protected final double mass = 4.002602;
        protected double fac;
<commit_msg>add LRC for simplified Helium<commit_after>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */


package etomica.potential;
import etomica.atom.IAtomList;
import etomica.box.Box;
import etomica.space.Space;
import etomica.units.Kelvin;
import etomica.util.Constants;

/**
 * Simplified pair potential for Helium.  The potential has the form of an
 * exponential-6 model with an additional r^-10 term.
 *
 * @author <NAME>
 */
public class P2HeSimplified extends Potential2SoftSpherical {
    
    public P2HeSimplified(Space space) {
        super(space);
    }

    /**
     * The energy u.
     */
    public double u(double r2) {

    	if (r2 < sigmaHC2) {
    		return Double.POSITIVE_INFINITY;
    	}

    	double r = Math.sqrt(r2);
        double r4 = r2*r2;
        double r6 = r4*r2;
        double r8 = r4*r4;
        double r10 = r6*r4;
        return A0*Math.exp(-A1*r)-A2/r6-A3/(useC10 ? r10 : r8);
    }

    /**
     * The derivative r*du/dr.
     */
    public double du(double r2) {
        double r = Math.sqrt(r2);
        double r4 = r2*r2;
        double r6 = r4*r2;
        double r8 = r4*r4;
        double r10 = r6*r4;
        return -A0*A1*Math.exp(-A1*r)*r + 6*A2/(r6) + A3*(useC10? 10/r10 : 8/r8);
    }

   /**
    * The second derivative of the pair energy, times the square of the
    * separation:  r^2 d^2u/dr^2.
    */
    public double d2u(double r2) {
        double r = Math.sqrt(r2);
        double r4 = r2*r2;
        double r6 = r4*r2;
        double r8 = r4*r4;
        double r10 = r6*r4;
        return A0*A1*A1*Math.exp(-A1*r)*r2 - 42*A2/(r6) - A3*(useC10? 110/r10 : 72/r8);
    }

    /**
     *  Integral used for corrections to potential truncation.
     */
    public double uInt(double rC) {
        double A = 4 * Math.PI;
        double sc = 1 / rC;
        double sc2 = sc * sc;
        double sc3 = sc * sc * sc;
        double sc6 = sc3 * sc3;
        double sc8 = sc6 * sc2;
        double sc10 = sc8 * sc2;
        double a = useC10 ? 10 : 8;
        // ignore exp term
        return -A * (A3 * (useC10 ? sc10 : sc8) / (a - 3) + A2 * sc6 / (6. - 3)) / sc3;
    }

    public P2HeQFH makeQFH(double temperature) {
        return this.new P2HeQFH(temperature);
    }

    /**
     * This inner class can calculates the Feynman-Hibbs semiclassical
     * approximation for the potential.  Results should be the same as using
     * P2EffectiveFeynmanHibbs, but should be faster, because u, du and d2u
     * are not called.  Much of the work is duplicated between those methods,
     * and they are all computed at the same time in this class.
     * 
     * This class is only ~10% slower than the classical potential.
     *
     * @author <NAME>
     */
    public class P2HeQFH implements Potential2Spherical {

        protected final double temperature;
        protected final double mass = 4.002602;
        protected double fac;

{'fraction_non_alphanumeric': 0.10651300855596298, 'fraction_numerical': 0.04784354810546534, 'mean_word_length': 2.130054644808743, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '3749988', 'n_tokens_mistral': 2116, 'n_tokens_neox': 1983, 'n_words': 608}