Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/RuleWorld/nfsim
Browse files Browse the repository at this point in the history
  • Loading branch information
ASinanSaglam committed Mar 16, 2023
2 parents b99398c + 8c3e64f commit 766c280
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/NFcore/NFcore.hh
Original file line number Diff line number Diff line change
Expand Up @@ -1012,8 +1012,8 @@ namespace NFcore
static void bind(Molecule *m1, string compName1, Molecule *m2, string compName2);
// AS2023 - unbind now returns the indices of the molecule that's selected
// for the unbinding for recording/logging purposesz
static tuple<int, int> unbind(Molecule *m1, int bSiteIndex);
static tuple<int, int> unbind(Molecule *m1, char * bSiteName);
static vector<int> unbind(Molecule *m1, int bSiteIndex);
static vector<int> unbind(Molecule *m1, char * bSiteName);


/* functions needed to traverse a complex and get all components
Expand Down
11 changes: 7 additions & 4 deletions src/NFcore/molecule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ void Molecule::bind(Molecule *m1, string compName1, Molecule *m2, string compNam

// AS2023 - unbind can return the index of the molecule and component it
// selected for the unbinding for tracking purposes
tuple<int, int> Molecule::unbind(Molecule *m1, int cIndex)
vector<int> Molecule::unbind(Molecule *m1, int cIndex)
{
//get the other molecule bound to this site
//cout<<"I am here. "<<bSiteIndex<<endl;
Expand Down Expand Up @@ -593,11 +593,14 @@ tuple<int, int> Molecule::unbind(Molecule *m1, int cIndex)
//cout<<" UnBinding! mol1 complex: ";
//m1->getComplex()->printDetails();

// AS2023 - this now returns what is unbound in a tuple
return make_tuple(m2->getUniqueID(), cIndex2);
// AS2023 - this now returns what is unbound in a vector
vector<int> tpl;
tpl.push_back(m2->getUniqueID());
tpl.push_back(cIndex2);
return tpl;
}

tuple<int, int> Molecule::unbind(Molecule *m1, char * compName)
vector<int> Molecule::unbind(Molecule *m1, char * compName)
{
int cIndex = m1->getMoleculeType()->getCompIndexFromName(compName);
return Molecule::unbind(m1,cIndex);
Expand Down
8 changes: 6 additions & 2 deletions src/NFreactions/transformations/transformation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,16 @@ UnbindingTransform::UnbindingTransform(int cIndex, TemplateMolecule * tm) :
}
void UnbindingTransform::apply(Mapping *m, MappingSet **ms)
{
auto [m2id, c2id] = Molecule::unbind(m->getMolecule(),m->getIndex());
vector<int> tpl = Molecule::unbind(m->getMolecule(),m->getIndex());
int m2id = tpl[0];
int c2id = tpl[1];
}
// AS2023 - alternative call sig to store a log of the transform
void UnbindingTransform::apply(Mapping *m, MappingSet **ms, string &logstr)
{ //cout<<"unbinding.."<<endl;
auto [m2id, c2id] = Molecule::unbind(m->getMolecule(),m->getIndex());
vector<int> tpl = Molecule::unbind(m->getMolecule(),m->getIndex());
int m2id = tpl[0];
int c2id = tpl[1];
if (!logstr.empty()) {
logstr += " [\"DeleteBond\","
+ to_string(m->getMolecule()->getUniqueID())
Expand Down

0 comments on commit 766c280

Please sign in to comment.