Skip to content

Commit

Permalink
Add type alias and pointer in arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
HomesGH committed Jul 29, 2024
1 parent c903ba6 commit 23e8b9d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/molecules/Comp2Param.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


void Comp2Param::initialize(
const std::vector<Component>& components, std::map<int,std::map<int,MixingRuleBase*>> mixcoeff,
const std::vector<Component>& components, const MixRulesType & mixcoeff,
double epsRF, double rc, double rcLJ)
{
m_numcomp = components.size();
Expand Down Expand Up @@ -41,7 +41,7 @@ void Comp2Param::initialize(
for (unsigned int compj = compi + 1; compj < m_numcomp; ++compj) {
ParaStrm& pstrmij = m_ssparatbl(compi, compj);
unsigned int ncj = components[compj].numLJcenters();
const auto mixingrule = mixcoeff[compi][compj];
const auto mixingrule = mixcoeff.at(compi).at(compj);
// Generic mixing functions
std::function<double(double, double)> mixingSigma;
std::function<double(double, double)> mixingEpsilon;
Expand Down
7 changes: 5 additions & 2 deletions src/molecules/Comp2Param.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
* @author Martin Bernreuther <[email protected]> et al. (2010)
*/
class Comp2Param {

using MixRulesType = std::map<int,std::map<int,MixingRuleBase*>>;

public:
/** Create a new empty parameter stream. */
Comp2Param() : m_numcomp(0), m_ssparatbl(0,0) {}
Expand All @@ -22,7 +25,7 @@ class Comp2Param {
* the given components and parameters.
*/
Comp2Param(const std::vector<Component>& components,
std::map<int,std::map<int,MixingRuleBase*>> mixcoeff,
const MixRulesType & mixcoeff,
double epsRF, double rc, double rcLJ) :
m_numcomp(components.size()), m_ssparatbl(m_numcomp,m_numcomp)
{
Expand All @@ -39,7 +42,7 @@ class Comp2Param {
* The order of the entries must correspond to the
* PotForce() function found in potforce.h reading the stream
*/
void initialize(const std::vector<Component>& components, std::map<int,std::map<int,MixingRuleBase*>> mixcoeff, double epsRF, double rc, double rcLJ);
void initialize(const std::vector<Component>& components, const MixRulesType & mixcoeff, double epsRF, double rc, double rcLJ);

private:
unsigned int m_numcomp; /**< number of components */
Expand Down

0 comments on commit 23e8b9d

Please sign in to comment.