<commit_before>// Copyright (c) 2009-2019 The Regents of the University of Michigan
// This file is part of the HOOMD-blue project, released under the BSD 3-Clause License.


#ifndef __EVALUATOR_TERSOFF__
#define __EVALUATOR_TERSOFF__

#ifndef __HIPCC__
#include <string>
#endif

#include "hoomd/HOOMDMath.h"

/*! \file EvaluatorTersoff.h
    \brief Defines the evaluator class for the three-body Tersoff potential
*/

#ifdef __HIPCC__
#define DEVICE __device__
#define HOSTDEVICE __host__ __device__
#else
#define DEVICE
#define HOSTDEVICE
#endif


//! Class for evaluating the Tersoff three-body potential
class EvaluatorTersoff
    {
    public:
        //! Parameter type for this potential
        struct param_type
            {
            Scalar cutoff_thickness; //!< Thickness of the cutoff shell (2D)
            Scalar2 coeffs; //!< Contains the coefficients for the repulsive (x) and attractive (y) terms
            Scalar2 exp_consts; //!< Gives the coefficients in the exponential functions for the repulsive (x) and attractive (y) terms
            Scalar dimer_r; //!< Dimer separation of the type-pair
            Scalar tersoff_n; //!< \a n in Tersoff potential
            Scalar gamman; //!< \a gamma raised to the \a n power in the Tersoff potential
            Scalar lambda_cube; //!< \a lambda^3 in the exponential term of \a chi
            Scalar3 ang_consts; //!< Constants \a c^2, \a d^2, and \a m in the bond-angle function of the Tersoff potential
            Scalar alpha; //!< \a alpha in the exponential cutoff-smoothing function

            #ifdef ENABLE_HIP
            //! Set CUDA memory hints
            void set_memory_hint() const
                {
                // default implementation does nothing
                }
            #endif

            #ifndef __HIPCC__
            param_type() : cutoff_thickness(0), coeffs(make_scalar2(0, 0)), exp_consts(make_scalar2(0, 0)), dimer_r(0),
                tersoff_n(0), gamman(0), lambda_cube(0), ang_consts(make_scalar3(0, 0, 0)), alpha(0) {}

            param_type(pybind11::dict v)
                {
                auto C1(v["C1"].cast<Scalar>());
                auto C2(v["C2"].cast<Scalar>());
                auto cutoff_d(v["cutoff_d"].cast<Scalar>());
                auto lambda1(v["lambda1"].cast<Scalar>());
                auto lambda2(v["lambda2"].cast<Scalar>());
                auto lambda3(v["lambda3"].cast<Scalar>());
                dimer_r = v["dimer_r"].cast<Scalar>();
                auto n(v["n"].cast<Scalar>());
                auto gamma(v["gamma"].cast<Scalar>());
                auto c(v["c"].cast<Scalar>());
                auto d(v["d"].cast<Scalar>());
                auto m(v["m"].cast<Scalar>());
                alpha = v["alpha"].cast<Scalar>();

                cutoff_thickness = cutoff_d;
                coeffs = make_scalar2(C1, C2);
                exp_consts = make_scalar2(lambda1, lambda2);
                tersoff_n = n;
                gamman = pow(gamma, n);
                lambda_cube = pow(lambda3, 3);
                Scalar c2 = c * c;
                Scalar d2 = d * d;
                ang_consts = make_scalar3(c2, d2, m);
                }

            pybind11::dict asDict()
                {
                pybind11::dict v;
                v["C1"] = coeffs.x;
                v["C2"] = coeffs.y;
                v["cutoff_d"] = cutoff_thickness;
                v["lambda1"] = exp_consts.x;
                v["lambda2"] = exp_consts.y;
                v["lambda3"] = pow(lambda_cube, 1./3.);
                v["dimer_r"] = dimer_r;
                v["n"] = tersoff_n;
                v["gamma"] = pow(gamman, 1.0/tersoff_n);<commit_msg>simplify EvaluatorTersoff<commit_after>// Copyright (c) 2009-2019 The Regents of the University of Michigan
// This file is part of the HOOMD-blue project, released under the BSD 3-Clause License.


#ifndef __EVALUATOR_TERSOFF__
#define __EVALUATOR_TERSOFF__

#ifndef __HIPCC__
#include <string>
#endif

#include "hoomd/HOOMDMath.h"

/*! \file EvaluatorTersoff.h
    \brief Defines the evaluator class for the three-body Tersoff potential
*/

#ifdef __HIPCC__
#define DEVICE __device__
#define HOSTDEVICE __host__ __device__
#else
#define DEVICE
#define HOSTDEVICE
#endif


//! Class for evaluating the Tersoff three-body potential
class EvaluatorTersoff
    {
    public:
        //! Parameter type for this potential
        struct param_type
            {
            Scalar cutoff_thickness; //!< Thickness of the cutoff shell (2D)
            Scalar2 coeffs; //!< Contains the coefficients for the repulsive (x) and attractive (y) terms
            Scalar2 exp_consts; //!< Gives the coefficients in the exponential functions for the repulsive (x) and attractive (y) terms
            Scalar dimer_r; //!< Dimer separation of the type-pair
            Scalar tersoff_n; //!< \a n in Tersoff potential
            Scalar gamman; //!< \a gamma raised to the \a n power in the Tersoff potential
            Scalar lambda_cube; //!< \a lambda^3 in the exponential term of \a chi
            Scalar3 ang_consts; //!< Constants \a c^2, \a d^2, and \a m in the bond-angle function of the Tersoff potential
            Scalar alpha; //!< \a alpha in the exponential cutoff-smoothing function

            #ifdef ENABLE_HIP
            //! Set CUDA memory hints
            void set_memory_hint() const
                {
                // default implementation does nothing
                }
            #endif

            #ifndef __HIPCC__
            param_type() : cutoff_thickness(0), coeffs(make_scalar2(0, 0)), exp_consts(make_scalar2(0, 0)), dimer_r(0),
                tersoff_n(0), gamman(0), lambda_cube(0), ang_consts(make_scalar3(0, 0, 0)), alpha(0) {}

            param_type(pybind11::dict v)
                {
                auto C1(v["C1"].cast<Scalar>());
                auto C2(v["C2"].cast<Scalar>());
                cutoff_thickness = v["cutoff_thickness"].cast<Scalar>();
                auto lambda1(v["lambda1"].cast<Scalar>());
                auto lambda2(v["lambda2"].cast<Scalar>());
                auto lambda3(v["lambda3"].cast<Scalar>());
                dimer_r = v["dimer_r"].cast<Scalar>();
                auto n(v["n"].cast<Scalar>());
                auto gamma(v["gamma"].cast<Scalar>());
                auto c(v["c"].cast<Scalar>());
                auto d(v["d"].cast<Scalar>());
                auto m(v["m"].cast<Scalar>());
                alpha = v["alpha"].cast<Scalar>();

                coeffs = make_scalar2(C1, C2);
                exp_consts = make_scalar2(lambda1, lambda2);
                tersoff_n = n;
                gamman = pow(gamma, n);
                lambda_cube = pow(lambda3, 3);
                Scalar c2 = c * c;
                Scalar d2 = d * d;
                ang_consts = make_scalar3(c2, d2, m);
                }

            pybind11::dict asDict()
                {
                pybind11::dict v;
                v["C1"] = coeffs.x;
                v["C2"] = coeffs.y;
                v["cutoff_thickness"] = cutoff_thickness;
                v["lambda1"] = exp_consts.x;
                v["lambda2"] = exp_consts.y;
                v["lambda3"] = pow(lambda_cube, 1./3.);
                v["dimer_r"] = dimer_r;
                v["n"] = tersoff_n;
                v["gamma"] = pow(gamman, 1.0/tersoff_n);
{'fraction_non_alphanumeric': 0.12142953837823203, 'fraction_numerical': 0.018952213347773115, 'mean_word_length': 1.863565891472868, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 31, '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': '3072631', 'n_tokens_mistral': 2400, 'n_tokens_neox': 2205, 'n_words': 586}