@@ -343,11 +343,11 @@ static const RegisterMetaType<BoreschRestraints> r_borrests;
343343
344344QDataStream &operator <<(QDataStream &ds, const BoreschRestraints &borrests)
345345{
346- writeHeader (ds, r_borrests, 1 );
346+ writeHeader (ds, r_borrests, 2 );
347347
348348 SharedDataStream sds (ds);
349349
350- sds << borrests.r
350+ sds << borrests.r << borrests. use_pbc
351351 << static_cast <const Restraints &>(borrests);
352352
353353 return ds;
@@ -363,8 +363,15 @@ QDataStream &operator>>(QDataStream &ds, BoreschRestraints &borrests)
363363
364364 sds >> borrests.r >> static_cast <Restraints &>(borrests);
365365 }
366+ else if (v == 2 )
367+ {
368+ SharedDataStream sds (ds);
369+
370+ sds >> borrests.r >> borrests.use_pbc
371+ >> static_cast <Restraints &>(borrests);
372+ }
366373 else
367- throw version_error (v, " 1" , r_borrests, CODELOC );
374+ throw version_error (v, " 1,2 " , r_borrests, CODELOC );
368375
369376 return ds;
370377}
@@ -417,7 +424,7 @@ BoreschRestraints::BoreschRestraints(const QString &name,
417424}
418425
419426BoreschRestraints::BoreschRestraints (const BoreschRestraints &other)
420- : ConcreteProperty<BoreschRestraints, Restraints>(other), r(other.r)
427+ : ConcreteProperty<BoreschRestraints, Restraints>(other), r(other.r), use_pbc(other.use_pbc)
421428{
422429}
423430
@@ -428,13 +435,15 @@ BoreschRestraints::~BoreschRestraints()
428435BoreschRestraints &BoreschRestraints::operator =(const BoreschRestraints &other)
429436{
430437 r = other.r ;
438+ use_pbc = other.use_pbc ;
431439 Restraints::operator =(other);
432440 return *this ;
433441}
434442
435443bool BoreschRestraints::operator ==(const BoreschRestraints &other) const
436444{
437- return r == other.r and Restraints::operator ==(other);
445+ return r == other.r and Restraints::operator ==(other) and
446+ use_pbc == other.use_pbc ;
438447}
439448
440449bool BoreschRestraints::operator !=(const BoreschRestraints &other) const
@@ -488,7 +497,11 @@ QString BoreschRestraints::toString() const
488497 }
489498 }
490499
491- return QObject::tr (" BoreschRestraints( name=%1, size=%2\n %3\n )" ).arg (this ->name ()).arg (n).arg (parts.join (" \n " ));
500+ return QObject::tr (" BoreschRestraints( name=%1, size=%2, use_pbc=%3\n %4\n )" )
501+ .arg (this ->name ())
502+ .arg (n)
503+ .arg (this ->use_pbc ? " true" : " false" )
504+ .arg (parts.join (" \n " ));
492505}
493506
494507/* * Return whether or not this is empty */
@@ -583,3 +596,15 @@ BoreschRestraints BoreschRestraints::operator+(const BoreschRestraints &restrain
583596 ret += restraints;
584597 return *this ;
585598}
599+
600+ /* * Set whether or not periodic boundary conditions are to be used */
601+ void BoreschRestraints::setUsesPeriodicBoundaryConditions (bool use_pbc)
602+ {
603+ this ->use_pbc = use_pbc;
604+ }
605+
606+ /* * Return whether or not periodic boundary conditions are to be used */
607+ bool BoreschRestraints::getUsesPeriodicBoundaryConditions () const
608+ {
609+ return this ->use_pbc ;
610+ }
0 commit comments