<commit_before>package etomica.potential;
import etomica.EtomicaInfo;
import etomica.space.ISpace;
import etomica.units.Dimension;
import etomica.units.Energy;
import etomica.units.Length;

/**
 * Soft-sphere interatomic potential.
 * Characterized by the pairwise-additive, spherically symmetric,
 *  inverse-power potential of the form:
 *  
 * 			     u(r) = epsilon*[sigma/ r]^n 
 * 
 * where epsilon:  describes the strength of the pair interaction, 
 *       sigma  :  is the atom size parameter
 *         n    :  is the degree of softness, s=1/n, 
 *               eg: hard sphere when s=0 or n->infinity
 *               
 *     sigma/r  : sig_r
 * 
 *
 * @author <NAME>
 */
public final class P2SoftSphere extends Potential2SoftSpherical {

    public P2SoftSphere(ISpace space) {
        this(space, 1.0, 1.0, 12);

    }
    
    public P2SoftSphere(ISpace space, double sigma, double epsilon, int n) {

        super(space);
        setSigma(sigma);
        setEpsilon(epsilon);
        setExponent(n);
    }
    
    public static EtomicaInfo getEtomicaInfo() {
        EtomicaInfo info = new EtomicaInfo("Soft-Sphere potential");
        return info;
    }

    /**
     * The energy u.
     */
    public double u(double r2) {
    	double sig_r = sigma/Math.sqrt(r2);
    	int expN = getExponent();
    	double sig_rn = 1;
    	
    	for (int i=0; i<expN; i++){
    			sig_rn *= sig_r;
    	}
    	
    	return epsilon*sig_rn;
    }

    /**
     * The derivative r*du/dr.
     */
    public double du(double r2) {
    	double sig_r = sigma/Math.sqrt(r2);
    	int expN = getExponent();
    	double sig_rn = 1;
    
    	for (int i=0; i<expN; i++){
    				sig_rn *= sig_r;
    	}
    	
        return -n*epsilon*sig_rn;
    }

   /**
    * 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 sig_r = sigma/Math.sqrt(r2);
    	int expN = getExponent();
    	double sig_rn = 1;
    
    	for (int i=0; i<expN; i++){
    				sig_rn *= sig_r;<commit_msg>use Math.pow for n greater than 50 and if n >= 1e6; potential becomes Hard potential<commit_after>package etomica.potential;
import etomica.EtomicaInfo;
import etomica.space.ISpace;
import etomica.units.Dimension;
import etomica.units.Energy;
import etomica.units.Length;

/**
 * Soft-sphere interatomic potential.
 * Characterized by the pairwise-additive, spherically symmetric,
 *  inverse-power potential of the form:
 *  
 * 			     u(r) = epsilon*[sigma/ r]^n 
 * 
 * where epsilon:  describes the strength of the pair interaction, 
 *       sigma  :  is the atom size parameter
 *         n    :  is the degree of softness, s=1/n, 
 *               eg: hard sphere when s=0 or n->infinity
 *               
 *     sigma/r  : sig_r
 * 
 *
 * @author <NAME>
 */
public final class P2SoftSphere extends Potential2SoftSpherical {

    public P2SoftSphere(ISpace space) {
        this(space, 1.0, 1.0, 12);

    }
    
    public P2SoftSphere(ISpace space, double sigma, double epsilon, int n) {

        super(space);
        setSigma(sigma);
        setEpsilon(epsilon);
        setExponent(n);
    }
    
    public static EtomicaInfo getEtomicaInfo() {
        EtomicaInfo info = new EtomicaInfo("Soft-Sphere potential");
        return info;
    }

    /**
     * The energy u.
     */
    public double u(double r2) {
    	double sig_r = sigma/Math.sqrt(r2);
    	int expN = getExponent();
    	double sig_rn = 1;
    	
    	if (n >= 1e6){
    		return sig_r <= 1.0 ? 0.0 : Double.POSITIVE_INFINITY; 
    	} 
    	
    	if(n > 50){
    		sig_rn = Math.pow(sig_r, n);
    		
    	} else {
	    	for (int i=0; i<expN; i++){
	    			sig_rn *= sig_r;
	    	}
    	}
    	
    	return epsilon*sig_rn;
    }

    /**
     * The derivative r*du/dr.
     */
    public double du(double r2) {
    	double sig_r = sigma/Math.sqrt(r2);
    	int expN = getExponent();
    	double sig_rn = 1;
    
    	for (int i=0; i<expN; i++){
    				sig_rn *= sig_r;
    	}
    	
        return -n*epsilon*sig_rn;
    }

   /**
    * 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 sig_r = sigma/Math.sqrt(r2);
    	int expN = getExponent();
    	double sig_rn = 1;
    
    	for (int i=0; i<expN; i++){
    				sig_rn *= sig_r;
{'fraction_non_alphanumeric': 0.11465694096193299, 'fraction_numerical': 0.015500341919307043, 'mean_word_length': 2.0728291316526612, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 10, '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': '3850185', 'n_tokens_mistral': 1652, 'n_tokens_neox': 1564, 'n_words': 395}