Skip to content

Commit

Permalink
Removed changes relating to the LJ C4 work. Will do this in another b…
Browse files Browse the repository at this point in the history
…ranch
  • Loading branch information
chryswoods committed Nov 15, 2023
1 parent 71c78b7 commit 56e6127
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 161 deletions.
54 changes: 12 additions & 42 deletions corelib/src/libs/SireIO/amberprm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,6 @@ void AmberPrm::rebuildLJParameters()

const auto acoeffs = float_data.value("LENNARD_JONES_ACOEF");
const auto bcoeffs = float_data.value("LENNARD_JONES_BCOEF");
const auto ccoeffs = float_data.value("LENNARD_JONES_CCOEF");

const auto hbond_acoeffs = float_data.value("HBOND_ACOEF");
const auto hbond_bcoeffs = float_data.value("HBOND_BCOEF");
Expand All @@ -402,17 +401,6 @@ void AmberPrm::rebuildLJParameters()
CODELOC);
}

if ((not ccoeffs.isEmpty()) and (ccoeffs.count() != acoeffs.count()))
{
throw SireIO::parse_error(QObject::tr("Incorrect number of LJ coefficients for the number of specified "
"atom types! Should be %1 for %2 types, but actually have "
"%3 LJ C-coefficients")
.arg((ntypes * (ntypes + 1)) / 2)
.arg(ntypes)
.arg(ccoeffs.count()),
CODELOC);
}

if (nb_parm_index.count() != ntypes * ntypes)
{
throw SireIO::parse_error(QObject::tr("Incorrect number of non-bonded parameter indicies. There should "
Expand All @@ -436,12 +424,11 @@ void AmberPrm::rebuildLJParameters()

const auto acoeffs_data = acoeffs.constData();
const auto bcoeffs_data = bcoeffs.constData();

const auto hbond_acoeffs_data = hbond_acoeffs.constData();
const auto hbond_bcoeffs_data = hbond_bcoeffs.constData();
const auto nb_parm_index_data = nb_parm_index.constData();

for (int i = 0; i < ntypes; ++i)
auto build_lj = [&](int i)
{
// amber stores the A and B coefficients as the product of all
// possible combinations. We need to find the values from the
Expand Down Expand Up @@ -474,39 +461,22 @@ void AmberPrm::rebuildLJParameters()

lj_data_array[i] = LJParameter(sigma * angstrom, epsilon * kcal_per_mol);
}
}
};

if (not ccoeffs.isEmpty())
if (usesParallel())
{
// we need to create a matrix mapping the C4 terms for pairs
// of LJ parameters
QHash<LJParameter, QHash<LJParameter, double>> lj_c4_values;

const auto ccoeffs_data = ccoeffs.constData();

// find all of the C4 co-efficients for all of the types
for (int i = 0; i < ntypes; ++i)
{
for (int j = 0; i < ntypes; ++j)
tbb::parallel_for(tbb::blocked_range<int>(0, ntypes), [&](tbb::blocked_range<int> r)
{
for (int i = r.begin(); i < r.end(); ++i)
{
const int idx = nb_parm_index_data[ntypes * i + j];

const double ccoeff = ccoeffs_data[idx - 1];

if (ccoeff != 0)
{
const auto &lj0 = lj_data_array[i];
const auto &lj1 = lj_data_array[j];

lj_c4_values[lj0][lj1] = ccoeff;
lj_c4_values[lj1][lj0] = ccoeff;
}
}
}

// now give each LJParameter its C4 values for all other types
build_lj(i);
} });
}
else
{
for (int i = 0; i < ntypes; ++i)
{
build_lj(i);
}
}

Expand Down
2 changes: 0 additions & 2 deletions corelib/src/libs/SireMM/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ set ( SIREMM_HEADERS
intragroupff.h
intraljff.h
intrasoftcljff.h
ljc4parameter.h
ljfunction.h
ljpair.h
ljparameter.h
Expand Down Expand Up @@ -161,7 +160,6 @@ set ( SIREMM_SOURCES
intragroupff.cpp
intraljff.cpp
intrasoftcljff.cpp
ljc4parameter.cpp
ljpair.cpp
ljparameter.cpp
ljparameterdb.cpp
Expand Down
28 changes: 0 additions & 28 deletions corelib/src/libs/SireMM/ljc4parameter.cpp

This file was deleted.

89 changes: 0 additions & 89 deletions corelib/src/libs/SireMM/ljc4parameter.h

This file was deleted.

0 comments on commit 56e6127

Please sign in to comment.