@@ -74,7 +74,9 @@ QDataStream &operator>>(QDataStream &ds, BoreschRestraint &borrest)
7474 {
7575 SharedDataStream sds (ds);
7676
77- sds >> borrest.receptor_atms >> borrest.ligand_atms >> borrest._r0 >> borrest._theta0 >> borrest._phi0 >> borrest._kr >> borrest._ktheta >> borrest._kphi >> static_cast <Property &>(borrest);
77+ sds >> borrest.receptor_atms >> borrest.ligand_atms >> borrest._r0
78+ >> borrest._theta0 >> borrest._phi0 >> borrest._kr >> borrest._ktheta
79+ >> borrest._kphi >> static_cast <Property &>(borrest);
7880 }
7981 else
8082 throw version_error (v, " 1" , r_borrest, CODELOC);
@@ -343,11 +345,11 @@ static const RegisterMetaType<BoreschRestraints> r_borrests;
343345
344346QDataStream &operator <<(QDataStream &ds, const BoreschRestraints &borrests)
345347{
346- writeHeader (ds, r_borrests, 1 );
348+ writeHeader (ds, r_borrests, 2 );
347349
348350 SharedDataStream sds (ds);
349351
350- sds << borrests.r
352+ sds << borrests.r << borrests. use_pbc
351353 << static_cast <const Restraints &>(borrests);
352354
353355 return ds;
@@ -363,8 +365,15 @@ QDataStream &operator>>(QDataStream &ds, BoreschRestraints &borrests)
363365
364366 sds >> borrests.r >> static_cast <Restraints &>(borrests);
365367 }
368+ else if (v == 2 )
369+ {
370+ SharedDataStream sds (ds);
371+
372+ sds >> borrests.r >> borrests.use_pbc
373+ >> static_cast <Restraints &>(borrests);
374+ }
366375 else
367- throw version_error (v, " 1" , r_borrests, CODELOC);
376+ throw version_error (v, " 1,2 " , r_borrests, CODELOC);
368377
369378 return ds;
370379}
@@ -417,7 +426,7 @@ BoreschRestraints::BoreschRestraints(const QString &name,
417426}
418427
419428BoreschRestraints::BoreschRestraints (const BoreschRestraints &other)
420- : ConcreteProperty<BoreschRestraints, Restraints>(other), r(other.r)
429+ : ConcreteProperty<BoreschRestraints, Restraints>(other), r(other.r), use_pbc(other.use_pbc)
421430{
422431}
423432
@@ -428,13 +437,15 @@ BoreschRestraints::~BoreschRestraints()
428437BoreschRestraints &BoreschRestraints::operator =(const BoreschRestraints &other)
429438{
430439 r = other.r ;
440+ use_pbc = other.use_pbc ;
431441 Restraints::operator =(other);
432442 return *this ;
433443}
434444
435445bool BoreschRestraints::operator ==(const BoreschRestraints &other) const
436446{
437- return r == other.r and Restraints::operator ==(other);
447+ return r == other.r and Restraints::operator ==(other) and
448+ use_pbc == other.use_pbc ;
438449}
439450
440451bool BoreschRestraints::operator !=(const BoreschRestraints &other) const
@@ -488,7 +499,11 @@ QString BoreschRestraints::toString() const
488499 }
489500 }
490501
491- return QObject::tr (" BoreschRestraints( name=%1, size=%2\n %3\n )" ).arg (this ->name ()).arg (n).arg (parts.join (" \n " ));
502+ return QObject::tr (" BoreschRestraints( name=%1, size=%2, use_pbc=%3\n %4\n )" )
503+ .arg (this ->name ())
504+ .arg (n)
505+ .arg (this ->use_pbc ? " true" : " false" )
506+ .arg (parts.join (" \n " ));
492507}
493508
494509/* * Return whether or not this is empty */
@@ -583,3 +598,15 @@ BoreschRestraints BoreschRestraints::operator+(const BoreschRestraints &restrain
583598 ret += restraints;
584599 return *this ;
585600}
601+
602+ /* * Set whether or not periodic boundary conditions are to be used */
603+ void BoreschRestraints::setUsesPbc (bool use_pbc)
604+ {
605+ this ->use_pbc = use_pbc;
606+ }
607+
608+ /* * Return whether or not periodic boundary conditions are to be used */
609+ bool BoreschRestraints::usesPbc () const
610+ {
611+ return this ->use_pbc ;
612+ }
0 commit comments