20 #ifndef OST_MM_GROMCACS_BLOCK_MODIFIERS_HH
21 #define OST_MM_GROMCACS_BLOCK_MODIFIERS_HH
24 #include <boost/shared_ptr.hpp>
37 namespace ost{
namespace mol{
namespace mm{
39 class GromacsHydrogenConstructor;
40 class GromacsTerminiConstructor;
51 const std::vector<geom::Vec3>& anchors);
65 const std::vector<String>& hydrogen_names,
66 const std::vector<String>& anchors);
73 const std::vector<String>&
75 const std::vector<String>&
82 template <
typename DS>
84 int num_hydrogen_add_rules = add_number_.size();
85 ds & num_hydrogen_add_rules;
88 add_number_ = std::vector<int>(num_hydrogen_add_rules);
89 methods_ = std::vector<int>(num_hydrogen_add_rules);
90 hydrogen_names_ = std::vector<std::vector<String> >(num_hydrogen_add_rules);
91 anchor_atom_names_ = std::vector<std::vector<String> >(num_hydrogen_add_rules);
94 for(
int i = 0; i < num_hydrogen_add_rules; ++i){
97 int num_hydrogen_names = hydrogen_names_[i].size();
98 int num_anchor_names = anchor_atom_names_[i].size();
99 ds & num_hydrogen_names;
100 ds & num_anchor_names;
102 hydrogen_names_[i] = std::vector<String>(num_hydrogen_names);
103 anchor_atom_names_[i] = std::vector<String>(num_anchor_names);
106 for(
int j = 0; j < num_hydrogen_names; ++j){
107 ds & hydrogen_names_[i][j];
109 for(
int j = 0; j < num_anchor_names; ++j){
110 ds & anchor_atom_names_[i][j];
116 std::vector<int> add_number_;
117 std::vector<int> methods_;
118 std::vector<std::vector<String> > hydrogen_names_;
119 std::vector<std::vector<String> > anchor_atom_names_;
137 const std::vector<String>& atom_names,
138 const std::vector<String>& anchors,
142 bonds_.push_back(p); }
145 angles_.push_back(p); }
148 dihedrals_.push_back(p); }
151 impropers_.push_back(p); }
154 cmaps_.push_back(p); }
159 const std::vector<InteractionPtr>&
GetBonds()
const {
return bonds_; }
160 const std::vector<InteractionPtr>&
GetAngles()
const {
return angles_; }
161 const std::vector<InteractionPtr>&
GetDihedrals()
const {
return dihedrals_; }
162 const std::vector<InteractionPtr>&
GetImpropers()
const {
return impropers_; }
163 const std::vector<InteractionPtr>&
GetCmaps()
const {
return cmaps_; }
168 return replace_old_atom_name_[idx];
171 return replace_new_atom_name_[idx];
174 return replace_new_atom_type_[idx];
177 return replace_new_charge_[idx];
183 const std::vector<String>&
185 const std::vector<String>&
194 template <
typename DS>
197 int num_bonds = bonds_.size();
198 int num_angles = angles_.size();
199 int num_dihedrals = dihedrals_.size();
200 int num_impropers = impropers_.size();
201 int num_cmaps = cmaps_.size();
209 for(
int i = 0; i < num_bonds; ++i){
216 func_type = bonds_[i]->GetFuncType();
222 for(
int i = 0; i < num_angles; ++i){
229 func_type = angles_[i]->GetFuncType();
235 for(
int i = 0; i < num_dihedrals; ++i){
242 func_type = dihedrals_[i]->GetFuncType();
245 ds & *(dihedrals_[i]);
248 for(
int i = 0; i < num_impropers; ++i){
255 func_type = impropers_[i]->GetFuncType();
258 ds & *(impropers_[i]);
261 for(
int i = 0; i < num_cmaps; ++i){
268 func_type = cmaps_[i]->GetFuncType();
274 int num_replace_atoms = replace_old_atom_name_.size();
275 ds & num_replace_atoms;
278 replace_old_atom_name_ = std::vector<String>(num_replace_atoms);
279 replace_new_atom_name_ = std::vector<String>(num_replace_atoms);
280 replace_new_atom_type_ = std::vector<String>(num_replace_atoms);
281 replace_new_charge_ = std::vector<Real>(num_replace_atoms);
284 for(
int i = 0; i < num_replace_atoms; ++i){
285 ds & replace_old_atom_name_[i];
286 ds & replace_new_atom_name_[i];
287 ds & replace_new_atom_type_[i];
288 ds & replace_new_charge_[i];
291 int num_add_atoms = add_add_number_.size();
295 add_add_number_ = std::vector<int>(num_add_atoms);
296 add_methods_ = std::vector<int>(num_add_atoms);
297 add_atom_names_ = std::vector<std::vector<String> >(num_add_atoms);
298 add_anchor_atom_names_ = std::vector<std::vector<String> >(num_add_atoms);
299 add_atom_types_ = std::vector<String>(num_add_atoms);
300 add_charges_ = std::vector<Real>(num_add_atoms);
303 for(
int i = 0; i < num_add_atoms; ++i){
304 ds & add_add_number_[i];
305 ds & add_methods_[i];
306 ds & add_atom_types_[i];
307 ds & add_charges_[i];
308 int num_add_atom_names = add_atom_names_[i].size();
309 int num_add_anchor_atom_names = add_anchor_atom_names_[i].size();
310 ds & num_add_atom_names;
311 ds & num_add_anchor_atom_names;
313 add_atom_names_[i] = std::vector<String>(num_add_atom_names);
314 add_anchor_atom_names_[i] = std::vector<String>(num_add_anchor_atom_names);
316 for(
int j = 0; j < num_add_atom_names; ++j){
317 ds & add_atom_names_[i][j];
319 for(
int j = 0; j < num_add_anchor_atom_names; ++j){
320 ds & add_anchor_atom_names_[i][j];
324 int num_delete_atoms = delete_atom_names_.size();
325 ds & num_delete_atoms;
327 delete_atom_names_ = std::vector<String>(num_delete_atoms);
329 for(
int i = 0; i < num_delete_atoms; ++i){
330 ds & delete_atom_names_[i];
341 std::vector<InteractionPtr> bonds_;
342 std::vector<InteractionPtr> angles_;
343 std::vector<InteractionPtr> dihedrals_;
344 std::vector<InteractionPtr> impropers_;
345 std::vector<InteractionPtr> cmaps_;
348 std::vector<String> replace_old_atom_name_;
349 std::vector<String> replace_new_atom_name_;
350 std::vector<String> replace_new_atom_type_;
351 std::vector<Real> replace_new_charge_;
354 std::vector<int> add_add_number_;
355 std::vector<int> add_methods_;
356 std::vector<std::vector<String> > add_atom_names_;
357 std::vector<std::vector<String> > add_anchor_atom_names_;
358 std::vector<String> add_atom_types_;
359 std::vector<Real> add_charges_;
362 std::vector<String> delete_atom_names_;
virtual void OnSave(ost::io::BinaryDataSink &ds)
boost::shared_ptr< GromacsBlockModifier > GromacsBlockModifierPtr
uint GetNumReplaceRules() const
const std::vector< String > & GetDeleteAtoms() const
void AddReplaceRule(const String &name, const String &new_name, const String &new_type, Real new_charge)
void AddImproper(InteractionPtr p)
const std::vector< InteractionPtr > & GetBonds() const
boost::shared_ptr< Interaction > InteractionPtr
GromacsHydrogenConstructor()
Real GetReplaceRuleNewCharge(uint idx) const
void AddDihedral(InteractionPtr p)
virtual BlockModifierType GetBlockModifierType()
const String & GetAddRuleType(uint idx) const
uint GetNumHydrogenRules() const
boost::shared_ptr< GromacsHydrogenConstructor > GromacsHydrogenConstructorPtr
virtual void OnSave(ost::io::BinaryDataSink &ds)
const std::vector< String > & GetHydrogenRuleNames(uint idx) const
const String & GetReplaceRuleNewType(uint idx) const
const std::vector< InteractionPtr > & GetImpropers() const
const std::vector< String > & GetAddRuleNames(uint idx) const
virtual BlockModifierType GetBlockModifierType()
void AddAngle(InteractionPtr p)
const String & GetReplaceRuleName(uint idx) const
void AddDeleteAtom(const String &atom_name)
external coordinate system editor
uint GetNumAddRules() const
int GetHydrogenRuleMethod(uint idx) const
const std::vector< InteractionPtr > & GetAngles() const
boost::shared_ptr< GromacsTerminiConstructor > GromacsTerminiConstructorPtr
const std::vector< InteractionPtr > & GetDihedrals() const
void AddAddRule(int number, int method, const std::vector< String > &atom_names, const std::vector< String > &anchors, const String &type, Real charge)
const String & GetReplaceRuleNewName(uint idx) const
const std::vector< String > & GetAddRuleAnchors(uint idx) const
virtual void ApplyOnBuildingBlock(BuildingBlockPtr)
void AddCMap(InteractionPtr p)
virtual void ApplyOnResidue(ost::mol::ResidueHandle &res, ost::mol::XCSEditor &ed)
void AddBond(InteractionPtr p)
int GetAddRuleMethod(uint idx) const
void AddHydrogenRule(uint number, int method, const std::vector< String > &hydrogen_names, const std::vector< String > &anchors)
const std::vector< InteractionPtr > & GetCmaps() const
Real GetAddRuleCharge(uint idx) const
static std::vector< geom::Vec3 > EvaluatePosRule(int rule, int number, const std::vector< geom::Vec3 > &anchors)
const std::vector< String > & GetHydrogenRuleAnchors(uint idx) const
int GetHydrogenRuleNumber(uint idx) const
int GetAddRuleNumber(uint idx) const
virtual void ApplyOnResidue(ost::mol::ResidueHandle &res, ost::mol::XCSEditor &ed)
virtual void ApplyOnBuildingBlock(BuildingBlockPtr p)
boost::shared_ptr< BuildingBlock > BuildingBlockPtr