Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions corelib/src/libs/SireMM/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ set ( SIREMM_HEADERS
intragroupff.h
intraljff.h
intrasoftcljff.h
inversebondrestraints.h
lj1264parameter.h
ljfunction.h
ljpair.h
Expand Down Expand Up @@ -167,6 +168,7 @@ set ( SIREMM_SOURCES
intragroupff.cpp
intraljff.cpp
intrasoftcljff.cpp
inversebondrestraints.cpp
lj1264parameter.cpp
ljpair.cpp
ljparameter.cpp
Expand Down
33 changes: 27 additions & 6 deletions corelib/src/libs/SireMM/anglerestraints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,11 @@ static const RegisterMetaType<AngleRestraints> r_angrests;

QDataStream &operator<<(QDataStream &ds, const AngleRestraints &angrests)
{
writeHeader(ds, r_angrests, 1);
writeHeader(ds, r_angrests, 2);

SharedDataStream sds(ds);

sds << angrests.r
sds << angrests.r << angrests.use_pbc
<< static_cast<const Restraints &>(angrests);

return ds;
Expand All @@ -249,8 +249,15 @@ QDataStream &operator>>(QDataStream &ds, AngleRestraints &angrests)
sds >> angrests.r >>
static_cast<Restraints &>(angrests);
}
else if (v == 2)
{
SharedDataStream sds(ds);

sds >> angrests.r >> angrests.use_pbc
>> static_cast<Restraints &>(angrests);
}
else
throw version_error(v, "1", r_angrests, CODELOC);
throw version_error(v, "1,2", r_angrests, CODELOC);

return ds;
}
Expand Down Expand Up @@ -303,7 +310,7 @@ AngleRestraints::AngleRestraints(const QString &name,
}

AngleRestraints::AngleRestraints(const AngleRestraints &other)
: ConcreteProperty<AngleRestraints, Restraints>(other), r(other.r)
: ConcreteProperty<AngleRestraints, Restraints>(other), r(other.r), use_pbc(other.use_pbc)
{
}

Expand All @@ -318,14 +325,15 @@ AngleRestraints &AngleRestraints::operator=(const AngleRestraints &other)
{
Restraints::operator=(other);
r = other.r;
use_pbc = other.use_pbc;
}

return *this;
}

bool AngleRestraints::operator==(const AngleRestraints &other) const
{
return r == other.r and Restraints::operator==(other);
return r == other.r and Restraints::operator==(other) and use_pbc == other.use_pbc;
}

bool AngleRestraints::operator!=(const AngleRestraints &other) const
Expand Down Expand Up @@ -379,9 +387,10 @@ QString AngleRestraints::toString() const
}
}

return QObject::tr("AngleRestraints( name=%1, size=%2\n%3\n )")
return QObject::tr("AngleRestraints( name=%1, size=%2, use_pbc=%3\n%4\n )")
.arg(this->name())
.arg(n)
.arg(this->use_pbc ? "true" : "false")
.arg(parts.join("\n"));
}

Expand Down Expand Up @@ -477,3 +486,15 @@ AngleRestraints AngleRestraints::operator+(const AngleRestraints &restraints) co
ret += restraints;
return *this;
}

/** Set whether or not periodic boundary conditions are to be used */
void AngleRestraints::setUsesPbc(bool use_pbc)
{
this->use_pbc = use_pbc;
}

/** Return whether or not periodic boundary conditions are to be used */
bool AngleRestraints::usesPbc() const
{
return this->use_pbc;
}
6 changes: 6 additions & 0 deletions corelib/src/libs/SireMM/anglerestraints.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,15 @@ namespace SireMM
AngleRestraints operator+(const AngleRestraint &restraint) const;
AngleRestraints operator+(const AngleRestraints &restraints) const;

void setUsesPbc(bool use_pbc);
bool usesPbc() const;

private:
/** List of restraints */
QList<AngleRestraint> r;

/** Whether the restraints use periodic boundary conditions */
bool use_pbc = false;
};
}

Expand Down
36 changes: 30 additions & 6 deletions corelib/src/libs/SireMM/bondrestraints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,11 @@ static const RegisterMetaType<BondRestraints> r_bndrests;

QDataStream &operator<<(QDataStream &ds, const BondRestraints &bndrests)
{
writeHeader(ds, r_bndrests, 1);
writeHeader(ds, r_bndrests, 2);

SharedDataStream sds(ds);

sds << bndrests.r
sds << bndrests.r << bndrests.use_pbc
<< static_cast<const Restraints &>(bndrests);

return ds;
Expand All @@ -370,8 +370,15 @@ QDataStream &operator>>(QDataStream &ds, BondRestraints &bndrests)

sds >> bndrests.r >> static_cast<Restraints &>(bndrests);
}
else if (v == 2)
{
SharedDataStream sds(ds);

sds >> bndrests.r >> bndrests.use_pbc
>> static_cast<Restraints &>(bndrests);
}
else
throw version_error(v, "1", r_bndrests, CODELOC);
throw version_error(v, "1,2", r_bndrests, CODELOC);

return ds;
}
Expand Down Expand Up @@ -424,7 +431,7 @@ BondRestraints::BondRestraints(const QString &name,
}

BondRestraints::BondRestraints(const BondRestraints &other)
: ConcreteProperty<BondRestraints, Restraints>(other), r(other.r)
: ConcreteProperty<BondRestraints, Restraints>(other), r(other.r), use_pbc(other.use_pbc)
{
}

Expand All @@ -435,13 +442,14 @@ BondRestraints::~BondRestraints()
BondRestraints &BondRestraints::operator=(const BondRestraints &other)
{
r = other.r;
use_pbc = other.use_pbc;
Restraints::operator=(other);
return *this;
}

bool BondRestraints::operator==(const BondRestraints &other) const
{
return r == other.r and Restraints::operator==(other);
return r == other.r and Restraints::operator==(other) and use_pbc == other.use_pbc;
}

bool BondRestraints::operator!=(const BondRestraints &other) const
Expand Down Expand Up @@ -495,7 +503,11 @@ QString BondRestraints::toString() const
}
}

return QObject::tr("BondRestraints( name=%1, size=%2\n%3\n)").arg(this->name()).arg(n).arg(parts.join("\n"));
return QObject::tr("BondRestraints( name=%1, size=%2, use_pbc=$3\n%4\n)")
.arg(this->name())
.arg(n)
.arg(this->use_pbc ? "true" : "false")
.arg(parts.join("\n"));
}

/** Return whether or not this is empty */
Expand Down Expand Up @@ -678,3 +690,15 @@ BondRestraints BondRestraints::operator+(const BondRestraints &restraints) const
ret += restraints;
return *this;
}

/** Set whether or not periodic boundary conditions are to be used */
void BondRestraints::setUsesPbc(bool use_pbc)
{
this->use_pbc = use_pbc;
}

/** Return whether or not periodic boundary conditions are to be used */
bool BondRestraints::usesPbc() const
{
return this->use_pbc;
}
6 changes: 6 additions & 0 deletions corelib/src/libs/SireMM/bondrestraints.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,15 @@ namespace SireMM
BondRestraints operator+(const BondRestraint &restraint) const;
BondRestraints operator+(const BondRestraints &restraints) const;

void setUsesPbc(bool use_pbc);
bool usesPbc() const;

private:
/** The actual list of restraints*/
QList<BondRestraint> r;

/** Whether the restraints use periodic boundary conditions */
bool use_pbc = false;
};

}
Expand Down
41 changes: 34 additions & 7 deletions corelib/src/libs/SireMM/boreschrestraints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ QDataStream &operator>>(QDataStream &ds, BoreschRestraint &borrest)
{
SharedDataStream sds(ds);

sds >> borrest.receptor_atms >> borrest.ligand_atms >> borrest._r0 >> borrest._theta0 >> borrest._phi0 >> borrest._kr >> borrest._ktheta >> borrest._kphi >> static_cast<Property &>(borrest);
sds >> borrest.receptor_atms >> borrest.ligand_atms >> borrest._r0
>> borrest._theta0 >> borrest._phi0 >> borrest._kr >> borrest._ktheta
>> borrest._kphi >> static_cast<Property &>(borrest);
}
else
throw version_error(v, "1", r_borrest, CODELOC);
Expand Down Expand Up @@ -343,11 +345,11 @@ static const RegisterMetaType<BoreschRestraints> r_borrests;

QDataStream &operator<<(QDataStream &ds, const BoreschRestraints &borrests)
{
writeHeader(ds, r_borrests, 1);
writeHeader(ds, r_borrests, 2);

SharedDataStream sds(ds);

sds << borrests.r
sds << borrests.r << borrests.use_pbc
<< static_cast<const Restraints &>(borrests);

return ds;
Expand All @@ -363,8 +365,15 @@ QDataStream &operator>>(QDataStream &ds, BoreschRestraints &borrests)

sds >> borrests.r >> static_cast<Restraints &>(borrests);
}
else if (v == 2)
{
SharedDataStream sds(ds);

sds >> borrests.r >> borrests.use_pbc
>> static_cast<Restraints &>(borrests);
}
else
throw version_error(v, "1", r_borrests, CODELOC);
throw version_error(v, "1,2", r_borrests, CODELOC);

return ds;
}
Expand Down Expand Up @@ -417,7 +426,7 @@ BoreschRestraints::BoreschRestraints(const QString &name,
}

BoreschRestraints::BoreschRestraints(const BoreschRestraints &other)
: ConcreteProperty<BoreschRestraints, Restraints>(other), r(other.r)
: ConcreteProperty<BoreschRestraints, Restraints>(other), r(other.r), use_pbc(other.use_pbc)
{
}

Expand All @@ -428,13 +437,15 @@ BoreschRestraints::~BoreschRestraints()
BoreschRestraints &BoreschRestraints::operator=(const BoreschRestraints &other)
{
r = other.r;
use_pbc = other.use_pbc;
Restraints::operator=(other);
return *this;
}

bool BoreschRestraints::operator==(const BoreschRestraints &other) const
{
return r == other.r and Restraints::operator==(other);
return r == other.r and Restraints::operator==(other) and
use_pbc == other.use_pbc;
}

bool BoreschRestraints::operator!=(const BoreschRestraints &other) const
Expand Down Expand Up @@ -488,7 +499,11 @@ QString BoreschRestraints::toString() const
}
}

return QObject::tr("BoreschRestraints( name=%1, size=%2\n%3\n)").arg(this->name()).arg(n).arg(parts.join("\n"));
return QObject::tr("BoreschRestraints( name=%1, size=%2, use_pbc=%3\n%4\n)")
.arg(this->name())
.arg(n)
.arg(this->use_pbc ? "true" : "false")
.arg(parts.join("\n"));
}

/** Return whether or not this is empty */
Expand Down Expand Up @@ -583,3 +598,15 @@ BoreschRestraints BoreschRestraints::operator+(const BoreschRestraints &restrain
ret += restraints;
return *this;
}

/** Set whether or not periodic boundary conditions are to be used */
void BoreschRestraints::setUsesPbc(bool use_pbc)
{
this->use_pbc = use_pbc;
}

/** Return whether or not periodic boundary conditions are to be used */
bool BoreschRestraints::usesPbc() const
{
return this->use_pbc;
}
6 changes: 6 additions & 0 deletions corelib/src/libs/SireMM/boreschrestraints.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,15 @@ namespace SireMM
BoreschRestraints operator+(const BoreschRestraint &restraint) const;
BoreschRestraints operator+(const BoreschRestraints &restraints) const;

void setUsesPbc(bool use_pbc);
bool usesPbc() const;

private:
/** The actual list of restraints*/
QList<BoreschRestraint> r;

/** Whether the restraints use periodic boundary conditions */
bool use_pbc = false;
};

}
Expand Down
Loading
Loading