20 #ifndef OST_MM_TOPOLOGY_HH
21 #define OST_MM_TOPOLOGY_HH
27 #include <boost/shared_ptr.hpp>
47 namespace ost {
namespace mol{
namespace mm{
57 Topology(
const std::vector<Real>& masses);
81 Real angle_force_constant,
83 Real bond_force_constant);
106 Real force_constant);
114 std::vector<Real> values);
142 Real x_scale = 1.0,
Real y_scale = 1.0,
Real z_scale = 1.0);
154 void SetSigmas(
const std::vector<Real>& sigmas);
158 void SetEpsilons(
const std::vector<Real>& epsilons);
170 void SetCharges(
const std::vector<Real>& charges);
174 void SetMasses(
const std::vector<Real>& masses);
184 Real& bond_length,
Real& force_constant)
const;
187 Real& angle,
Real& force_constant)
const;
190 Real& angle,
Real& angle_force_constant,
Real& bond_length,
Real& bond_force_constant)
const;
193 int& multiplicity,
Real& phase,
Real& force_constant)
const;
196 int& multiplicity,
Real& phase,
Real& force_constant)
const;
199 Real& angle,
Real& force_constant)
const;
202 int& dimension, std::vector<Real>& map)
const;
208 Real& distance)
const;
214 Real& force_constant)
const;
233 const Real bond_length,
const Real bond_force_constant);
236 const Real phase,
const Real force_constant);
239 const Real force_constant);
250 Real x_scale = 1.0,
Real y_scale = 1.0,
Real z_scale = 1.0);
258 const std::vector<std::pair<Index<2>, std::vector<Real> > >&
GetHarmonicBonds()
const {
return harmonic_bonds_; }
260 const std::vector<std::pair<Index<3>, std::vector<Real> > >&
GetHarmonicAngles()
const {
return harmonic_angles_; }
262 const std::vector<std::pair<Index<3>, std::vector<Real> > >&
GetUreyBradleyAngles()
const {
return urey_bradley_angles_; }
264 const std::vector<std::pair<Index<4>, std::vector<Real> > >&
GetPeriodicDihedrals()
const {
return periodic_dihedrals_; }
266 const std::vector<std::pair<Index<4>, std::vector<Real> > >&
GetPeriodicImpropers()
const {
return periodic_impropers_; }
268 const std::vector<std::pair<Index<4>, std::vector<Real> > >&
GetHarmonicImpropers()
const {
return harmonic_impropers_; }
270 const std::vector<std::pair<Index<5>, std::vector<Real> > >&
GetCMaps()
const {
return cmaps_; }
272 const std::vector<std::pair<Index<2>, std::vector<Real> > >&
GetLJPairs()
const {
return lj_pairs_; }
274 const std::vector<std::pair<Index<2>, std::vector<Real> > >&
GetDistanceConstraints()
const {
return distance_constraints_; }
284 const std::vector<std::pair<Index<2>, std::vector<Real> > >&
GetFGMDHBondDonors()
const {
return fgmd_hbond_donors_; }
313 std::vector<Real>
GetMasses()
const {
return atom_masses_; }
320 uint index_two)
const;
324 uint index_three)
const;
328 uint index_three)
const;
333 uint index_four)
const;
338 uint index_four)
const;
343 uint index_four)
const;
349 uint index_five)
const;
352 uint index_two)
const;
355 uint index_two)
const;
360 uint index_two)
const;
363 uint index_two)
const;
366 uint index_two)
const;
430 template <
typename DS>
443 atom_masses_ = std::vector<Real>(num_items);
445 sigmas_ = std::vector<Real>(num_items);
447 epsilons_ = std::vector<Real>(num_items);
449 gbsa_radii_ = std::vector<Real>(num_items);
451 obc_scaling_ = std::vector<Real>(num_items);
453 charges_ = std::vector<Real>(num_items);
455 position_constraints_ = std::vector<uint>(num_items);
458 num_items = atom_masses_.size();
460 num_items = sigmas_.size();
462 num_items = epsilons_.size();
464 num_items = gbsa_radii_.size();
466 num_items = obc_scaling_.size();
468 num_items = charges_.size();
470 num_items = position_constraints_.size();
474 for(std::vector<Real>::iterator i = atom_masses_.begin();
475 i != atom_masses_.end(); ++i){
479 for(std::vector<Real>::iterator i = sigmas_.begin();
480 i != sigmas_.end(); ++i){
484 for(std::vector<Real>::iterator i = epsilons_.begin();
485 i != epsilons_.end(); ++i){
489 for(std::vector<Real>::iterator i = gbsa_radii_.begin();
490 i != gbsa_radii_.end(); ++i){
494 for(std::vector<Real>::iterator i = obc_scaling_.begin();
495 i != obc_scaling_.end(); ++i){
499 for(std::vector<Real>::iterator i = charges_.begin();
500 i != charges_.end(); ++i){
504 for(std::vector<uint>::iterator i = position_constraints_.begin();
505 i != position_constraints_.end(); ++i){
511 for(
uint i = 0; i < num_items; ++i){
512 harmonic_bonds_.push_back(std::make_pair(
Index<2>(),std::vector<Real>(2)));
516 for(
uint i = 0; i < num_items; ++i){
517 harmonic_angles_.push_back(std::make_pair(
Index<3>(),std::vector<Real>(2)));
521 for(
uint i = 0; i < num_items; ++i){
522 urey_bradley_angles_.push_back(std::make_pair(
Index<3>(),std::vector<Real>(4)));
526 for(
uint i = 0; i < num_items; ++i){
527 periodic_dihedrals_.push_back(std::make_pair(
Index<4>(),std::vector<Real>(3)));
531 for(
uint i = 0; i < num_items; ++i){
532 periodic_impropers_.push_back(std::make_pair(
Index<4>(),std::vector<Real>(3)));
536 for(
uint i = 0; i < num_items; ++i){
537 harmonic_impropers_.push_back(std::make_pair(
Index<4>(),std::vector<Real>(2)));
541 for(
uint i = 0; i < num_items; ++i){
544 cmaps_.push_back(std::make_pair(
Index<5>(),std::vector<Real>(num_values)));
548 for(
uint i = 0; i < num_items; ++i){
549 lj_pairs_.push_back(std::make_pair(
Index<2>(),std::vector<Real>(2)));
553 for(
uint i = 0; i < num_items; ++i){
554 distance_constraints_.push_back(std::make_pair(
Index<2>(),std::vector<Real>(1)));
558 exclusions_ = std::vector<Index<2> >(num_items);
561 for(
uint i = 0; i < num_items; ++i){
562 harmonic_position_restraints_.push_back(std::make_pair(
Index<1>(),std::vector<Real>(7)));
566 for(
uint i = 0; i < num_items; ++i){
567 harmonic_distance_restraints_.push_back(std::make_pair(
Index<2>(),std::vector<Real>(2)));
571 for(
uint i = 0; i < num_items; ++i){
572 fgmd_hbond_donors_.push_back(std::make_pair(
Index<2>(),std::vector<Real>(6)));
576 for(
uint i = 0; i < num_items; ++i){
577 fgmd_hbond_acceptors_.push_back(
Index<2>());
581 num_items = harmonic_bonds_.size();
583 num_items = harmonic_angles_.size();
585 num_items = urey_bradley_angles_.size();
587 num_items = periodic_dihedrals_.size();
589 num_items = periodic_impropers_.size();
591 num_items = harmonic_impropers_.size();
593 num_items = cmaps_.size();
595 for(
uint i = 0; i < cmaps_.size(); ++i){
596 num_items = cmaps_[i].second.size();
599 num_items = lj_pairs_.size();
601 num_items = distance_constraints_.size();
603 num_items = exclusions_.size();
605 num_items = harmonic_position_restraints_.size();
607 num_items = harmonic_distance_restraints_.size();
609 num_items = fgmd_hbond_donors_.size();
611 num_items = fgmd_hbond_acceptors_.size();
615 for(std::vector<std::pair<
Index<2>,std::vector<Real> > >::iterator i = harmonic_bonds_.begin();
616 i != harmonic_bonds_.end(); ++i){
622 for(std::vector<std::pair<
Index<3>,std::vector<Real> > >::iterator i = harmonic_angles_.begin();
623 i != harmonic_angles_.end(); ++i){
629 for(std::vector<std::pair<
Index<3>,std::vector<Real> > >::iterator i = urey_bradley_angles_.begin();
630 i != urey_bradley_angles_.end(); ++i){
638 for(std::vector<std::pair<
Index<4>,std::vector<Real> > >::iterator i = periodic_dihedrals_.begin();
639 i != periodic_dihedrals_.end(); ++i){
646 for(std::vector<std::pair<
Index<4>,std::vector<Real> > >::iterator i = periodic_impropers_.begin();
647 i != periodic_impropers_.end(); ++i){
654 for(std::vector<std::pair<
Index<4>,std::vector<Real> > >::iterator i = harmonic_impropers_.begin();
655 i != harmonic_impropers_.end(); ++i){
661 for(std::vector<std::pair<
Index<5>,std::vector<Real> > >::iterator i = cmaps_.begin();
662 i != cmaps_.end(); ++i){
664 for(std::vector<Real>::iterator j = i->second.begin();
665 j != i->second.end(); ++j){
670 for(std::vector<std::pair<
Index<2>,std::vector<Real> > >::iterator i = lj_pairs_.begin();
671 i != lj_pairs_.end(); ++i){
677 for(std::vector<std::pair<
Index<2>,std::vector<Real> > >::iterator i = distance_constraints_.begin();
678 i != distance_constraints_.end(); ++i){
683 for(std::vector<
Index<2> >::iterator i = exclusions_.begin();
684 i != exclusions_.end(); ++i){
688 for(std::vector<std::pair<
Index<1>,std::vector<Real> > >::iterator i = harmonic_position_restraints_.begin();
689 i != harmonic_position_restraints_.end(); ++i){
700 for(std::vector<std::pair<
Index<2>,std::vector<Real> > >::iterator i = harmonic_distance_restraints_.begin();
701 i != harmonic_distance_restraints_.end(); ++i){
707 for(std::vector<std::pair<
Index<2>,std::vector<Real> > >::iterator i = fgmd_hbond_donors_.begin();
708 i != fgmd_hbond_donors_.end(); ++i){
718 for(std::vector<
Index<2> >::iterator i = fgmd_hbond_acceptors_.begin();
719 i != fgmd_hbond_acceptors_.end(); ++i){
725 for(
uint i = 0; i < num_items; ++i){
727 added_lj_pairs_.insert(actual_index);
731 for(
uint i = 0; i < num_items; ++i){
733 added_distance_constraints_.insert(actual_index);
737 for(
uint i = 0; i < num_items; ++i){
739 added_exclusions_.insert(actual_index);
743 num_items = added_lj_pairs_.size();
745 for(std::set<
Index<2> >::iterator i = added_lj_pairs_.begin();
746 i != added_lj_pairs_.end(); ++i){
750 num_items = added_distance_constraints_.size();
752 for(std::set<
Index<2> >::iterator i = added_distance_constraints_.begin();
753 i != added_distance_constraints_.end(); ++i){
757 num_items = added_exclusions_.size();
759 for(std::set<
Index<2> >::iterator i = added_exclusions_.begin();
760 i != added_exclusions_.end(); ++i){
785 std::vector<Real> atom_masses_;
786 std::vector<Real> sigmas_;
787 std::vector<Real> epsilons_;
788 std::vector<Real> gbsa_radii_;
789 std::vector<Real> obc_scaling_;
790 std::vector<Real> charges_;
791 std::vector<uint> position_constraints_;
794 std::vector<std::pair<Index<2>,std::vector<Real> > > harmonic_bonds_;
795 std::vector<std::pair<Index<3>,std::vector<Real> > > harmonic_angles_;
796 std::vector<std::pair<Index<3>,std::vector<Real> > > urey_bradley_angles_;
797 std::vector<std::pair<Index<4>,std::vector<Real> > > periodic_dihedrals_;
798 std::vector<std::pair<Index<4>,std::vector<Real> > > periodic_impropers_;
799 std::vector<std::pair<Index<4>,std::vector<Real> > > harmonic_impropers_;
800 std::vector<std::pair<Index<5>,std::vector<Real> > > cmaps_;
801 std::vector<std::pair<Index<2>,std::vector<Real> > > lj_pairs_;
802 std::vector<std::pair<Index<2>,std::vector<Real> > > distance_constraints_;
803 std::vector<Index<2> > exclusions_;
804 std::vector<std::pair<Index<1>,std::vector<Real> > > harmonic_position_restraints_;
805 std::vector<std::pair<Index<2>,std::vector<Real> > > harmonic_distance_restraints_;
806 std::vector<std::pair<Index<2>,std::vector<Real> > > fgmd_hbond_donors_;
807 std::vector<Index<2> > fgmd_hbond_acceptors_;
811 std::set<Index<2> > added_lj_pairs_;
812 std::set<Index<2> > added_distance_constraints_;
813 std::set<Index<2> > added_exclusions_;
817 Real density_resolution_;
818 Real density_scaling_;
819 std::vector<std::vector<int> > density_bodies_;
820 std::vector<bool> in_density_body_;
void GetLJPairParameters(uint index, uint &index_one, uint &index_two, Real &sigma, Real &epsilon) const
void SetEpsilon(uint index, Real epsilon)
const std::vector< std::pair< Index< 2 >, std::vector< Real > > > & GetLJPairs() const
uint GetNumPeriodicDihedrals()
void SetUreyBradleyAngleParameters(uint index, const Real angle, const Real angle_force_constant, const Real bond_length, const Real bond_force_constant)
void SetMass(uint index, Real mass)
uint AddPeriodicImproper(uint index_one, uint index_two, uint index_three, uint index_four, int multiplicity, Real phase, Real force_constant)
void SetFudgeQQ(Real fudge)
std::vector< uint > GetPeriodicImproperIndices(uint index_one, uint index_two, uint index_three, uint index_four) const
uint AddHarmonicBond(uint index_one, uint index_two, Real bond_length, Real force_constant)
uint GetNumPositionConstraints()
Real GetEpsilon(uint index) const
int GetLJPairIndex(uint index_one, uint index_two) const
void DefineDensityBody(const std::vector< int > &indices)
const std::vector< std::pair< Index< 2 >, std::vector< Real > > > & GetFGMDHBondDonors() const
std::vector< Real > GetMasses() const
int GetNumDensityBodies() const
void SetEpsilons(const std::vector< Real > &epsilons)
uint AddLJPair(uint index_one, uint index_two, Real sigma, Real epsilon)
const std::vector< std::pair< Index< 3 >, std::vector< Real > > > & GetUreyBradleyAngles() const
uint GetNumFGMDHBondAcceptors()
const std::vector< std::pair< Index< 4 >, std::vector< Real > > > & GetPeriodicImpropers() const
boost::shared_ptr< Topology > TopologyPtr
uint AddFGMDHBondAcceptor(uint index_one, uint index_two)
void SetDensity(const ost::img::ImageHandle &d, Real r, Real s=1.0)
std::vector< uint > GetHarmonicDistanceRestraintIndices(uint index_one, uint index_two) const
Real GetCharge(uint index) const
uint GetNumHarmonicDistanceRestraints()
std::vector< uint > GetFGMDHBondDonorIndices(uint index_one, uint index_two) const
uint GetNumDistanceConstraints()
const std::vector< std::pair< Index< 1 >, std::vector< Real > > > & GetHarmonicPositionRestraints() const
void SetGBSARadius(uint index, Real radius)
const std::vector< std::pair< Index< 5 >, std::vector< Real > > > & GetCMaps() const
void SetFGMDHBondDonorParameters(uint index, Real length, Real k_length, Real alpha, Real k_alpha, Real beta, Real k_beta)
void SetSigmas(const std::vector< Real > &sigmas)
void GetFGMDHBondAcceptorParameters(uint index, uint &index_one, uint &index_two) const
void SetOBCScalings(const std::vector< Real > &obc_scaling)
uint AddPeriodicDihedral(uint index_one, uint index_two, uint index_three, uint index_four, int multiplicity, Real phase, Real force_constant)
void SetCharges(const std::vector< Real > &charges)
std::vector< uint > GetCMapIndices(uint index_one, uint index_two, uint index_three, uint index_four, uint index_five) const
std::vector< uint > GetUreyBradleyAngleIndices(uint index_one, uint index_two, uint index_three) const
const std::vector< std::pair< Index< 2 >, std::vector< Real > > > & GetHarmonicDistanceRestraints() const
const std::vector< uint > & GetPositionConstraints() const
void SetCharge(uint index, Real charge)
std::vector< Real > GetCharges() const
uint AddHarmonicImproper(uint index_one, uint index_two, uint index_three, uint index_four, Real angle, Real force_constant)
ost::img::ImageHandle GetDensity()
void GetPeriodicImproperParameters(uint index, uint &index_one, uint &index_two, uint &index_three, uint &index_four, int &multiplicity, Real &phase, Real &force_constant) const
void AddPositionConstraint(uint index)
const std::vector< std::vector< int > > & GetDensityBodies() const
void GetHarmonicImproperParameters(uint index, uint &index_one, uint &index_two, uint &index_three, uint &index_four, Real &angle, Real &force_constant) const
std::vector< uint > GetLJPairIndices(uint atom_index) const
const std::vector< std::pair< Index< 2 >, std::vector< Real > > > & GetHarmonicBonds() const
void SetPeriodicImproperParameters(uint index, const int multiplicity, const Real phase, const Real force_constant)
void SetHarmonicPositionRestraintParameters(uint index, const geom::Vec3 &ref_position, Real k, Real x_scale=1.0, Real y_scale=1.0, Real z_scale=1.0)
void SetGBSARadii(const std::vector< Real > &gbsa_radii)
void SetFudgeLJ(Real fudge)
void GetDistanceConstraintParameters(uint index, uint &index_one, uint &index_two, Real &distance) const
uint AddHarmonicAngle(uint index_one, uint index_two, uint index_three, Real angle, Real force_constant)
const std::vector< std::pair< Index< 2 >, std::vector< Real > > > & GetDistanceConstraints() const
const std::vector< std::pair< Index< 4 >, std::vector< Real > > > & GetHarmonicImpropers() const
Real GetGBSARadius(uint index) const
Real GetMass(uint index) const
void Merge(ost::mol::EntityHandle &ent, TopologyPtr other, const ost::mol::EntityHandle &other_ent)
void GetUreyBradleyAngleParameters(uint index, uint &index_one, uint &index_two, uint &index_three, Real &angle, Real &angle_force_constant, Real &bond_length, Real &bond_force_constant) const
uint AddExclusion(uint index_one, uint index_two)
void ResetPositionConstraints()
void SetHarmonicDistanceRestraintParameters(uint index, Real length, Real force_constant)
uint GetNumFGMDHBondDonors()
uint GetNumHarmonicAngles()
void GetCMapParameters(uint index, uint &index_one, uint &index_two, uint &index_three, uint &index_four, uint &index_five, int &dimension, std::vector< Real > &map) const
uint AddFGMDHBondDonor(uint index_one, uint index_two, Real length, Real k_length, Real alpha, Real k_alpha, Real beta, Real k_beta)
uint AddHarmonicPositionRestraint(uint index, const geom::Vec3 &ref_position, Real k, Real x_scale=1.0, Real y_scale=1.0, Real z_scale=1.0)
void SetHarmonicImproperParameters(uint index, const Real angle, const Real force_constant)
const std::vector< Index< 2 > > & GetFGMDHBondAcceptors() const
uint AddHarmonicDistanceRestraint(uint index_one, uint index_two, Real length, Real force_constant)
std::vector< uint > GetHarmonicBondIndices(uint index_one, uint index_two) const
uint AddCMap(uint index_one, uint index_two, uint index_three, uint index_four, uint index_five, int dimension, std::vector< Real > values)
std::vector< uint > GetHarmonicAngleIndices(uint index_one, uint index_two, uint index_three) const
void SetMasses(const std::vector< Real > &masses)
std::vector< uint > GetPeriodicDihedralIndices(uint index_one, uint index_two, uint index_three, uint index_four) const
std::vector< uint > GetFGMDHBondAcceptorIndices(uint index_one, uint index_two) const
const std::vector< Index< 2 > > & GetExclusions() const
void SetDistanceConstraintParameters(uint index, const Real distance)
Three dimensional vector class, using Real precision.
void GetPeriodicDihedralParameters(uint index, uint &index_one, uint &index_two, uint &index_three, uint &index_four, int &multiplicity, Real &phase, Real &force_constant) const
Real GetSigma(uint index) const
std::vector< Real > GetEpsilons() const
int GetDistanceConstraintIndex(uint index_one, uint index_two) const
uint GetNumHarmonicPositionRestraints()
void GetHarmonicAngleParameters(uint index, uint &index_one, uint &index_two, uint &index_three, Real &angle, Real &force_constant) const
void GetFGMDHBondDonorParameters(uint index, uint &index_one, uint &index_two, Real &length, Real &k_length, Real &alpha, Real &k_alpha, Real &beta, Real &k_beta) const
void GetHarmonicDistanceRestraintParameters(uint index, uint &atom_one, uint &atom_two, Real &length, Real &force_constant) const
uint GetNumPeriodicImpropers()
std::vector< uint > GetDistanceConstraintIndices(uint atom_index) const
std::vector< uint > GetHarmonicPositionRestraintIndices(uint atom_index) const
void SetOBCScaling(uint index, Real scaling)
uint AddDistanceConstraint(uint index_one, uint index_two, Real distance)
void SetHarmonicAngleParameters(uint index, const Real angle, const Real force_constant)
std::vector< Real > GetOBCScalings() const
Manage shared instances of images.
const std::vector< std::pair< Index< 4 >, std::vector< Real > > > & GetPeriodicDihedrals() const
void SetHarmonicBondParameters(uint index, const Real bond_length, const Real force_constant)
uint AddUreyBradleyAngle(uint index_one, uint index_two, uint index_three, Real angle, Real angle_force_constant, Real bond_length, Real bond_force_constant)
static TopologyPtr Load(const String &filename)
const std::vector< std::pair< Index< 3 >, std::vector< Real > > > & GetHarmonicAngles() const
uint GetNumHarmonicImpropers()
Real GetOBCScaling(uint index) const
void SetCMapParameters(uint index, const int dimension, const std::vector< Real > &map)
void SetSigma(uint index, Real sigma)
void SetPeriodicDihedralParameters(uint index, const int multiplicity, const Real phase, const Real force_constant)
std::vector< uint > GetHarmonicImproperIndices(uint index_one, uint index_two, uint index_three, uint index_four) const
void GetHarmonicPositionRestraintParameters(uint index, uint &atom_index, geom::Vec3 &ref_position, Real &k, Real &x_scale, Real &y_scale, Real &z_scale) const
uint GetNumUreyBradleyAngles()
std::vector< Real > GetGBSARadii() const
Real GetDensityResolution()
void GetHarmonicBondParameters(uint index, uint &index_one, uint &index_two, Real &bond_length, Real &force_constant) const
void SetLJPairParameters(uint index, const Real sigma, const Real epsilon)
uint GetNumHarmonicBonds()
void Save(const String &filename)
std::vector< Real > GetSigmas() const