// // edip_single.hpp // // LGPL Version 2.1 HEADER START // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, // MA 02110-1301 USA // // LGPL Version 2.1 HEADER END // // // Copyright (c) 2021, Regents of the University of Minnesota. // All rights reserved. // // Contributors: // Yaser Afshar // // Brief: This file is adapted from the LAMMPS software package // `lammps/src/MANYBODY/pair_edip.cpp` // and it is rewritten and updated for the KIM-API by // Yaser Afshar // #ifndef EDIP_SINGLE_HPP #define EDIP_SINGLE_HPP #include #include #include "edip_param.hpp" namespace edip_single { static constexpr std::size_t kGridDensity{8000}; } // namespace edip_single /*! * \class EDIPSingle * \brief * */ class EDIPSingle { public: /*! * \brief Process and parse the edip/c parameter file * * \param parameter_file_pointer FILE pointer to the opened file * \param max_line_size maximum line size * \param element_name name of the unique element * \return int 0|false if everything goes well and 1|true if it fails */ int ProcessParameterFile(std::FILE *const parameter_file_pointer, int const max_line_size, std::vector const &element_name); /*! * \brief Convert units of the parameters * * \param convert_length_factor length unit conversion factor * \param convert_energy_factor energy unit conversion factor */ void ConvertUnit(double const convert_length_factor, double const convert_energy_factor); /*! * \brief Complete the set up * * \param max_cutoff */ void CompleteSetup(double *max_cutoff); /*! * \brief Grow local arrays * */ void Resize(); /*! * \brief Grow local arrays if necessary * * \param max_number_of_neighbors Maximum number of neighbors */ void Resize(std::size_t const max_number_of_neighbors); public: /*! Parameter set for an I-J-K interaction */ EDIPParam params_; /*! Length unit conversion factor */ double convert_length_factor_{1.0}; /*! Energy unit conversion factor */ double convert_energy_factor_{1.0}; /*! Max cutoff for all elements */ double cutmax_{0.0}; // grids /*! Grid start point */ double GridStart_{0.1}; // Helper arrays for grids /*! Grid cutoff function helper array */ std::vector cutoffFunction_; /*! Grid cutoff function derivative helper array */ std::vector cutoffFunctionDerived_; /*! Grid pow 2B helper array */ std::vector pow2B_; /*! Grid exp 2B helper array */ std::vector exp2B_; /*! Grid exp 3B helper array */ std::vector exp3B_; /*! Grid qfunction helper array */ std::vector qFunctionGrid_; /*! Grid helper array */ std::vector expMinusBetaZeta_iZeta_iGrid_; /*! Grid tau function helper array */ std::vector tauFunctionGrid_; /*! Grid tau function derivative helper array */ std::vector tauFunctionDerivedGrid_; /*! Temporary arrays */ // std::vector pre_force_rij_inverse_; std::vector pre_force_Exp3B_ij_; std::vector pre_force_Exp3BDerived_ij_; std::vector pre_force_Exp2B_ij_; std::vector pre_force_Exp2BDerived_ij_; std::vector pre_force_Pow2B_ij_; std::vector pre_force_coord_data_; }; #endif // EDIP_SINGLE