/*! The compute method save all possible move results into mChanges i-1 | | | i.......c | . | . | . i+1.....l i-1 --> c i -- > l */ void DoublePullMove::compute(Conf & theConf, Pos const thePos) { WatchError mChanges.clear(); // reset previous info if (!thePos || thePos >= Protein::p().Span()) return; Change tChange; for(Int pullDir = -1; pullDir <= 1; pullDir+=2) { for(Dir tDir1=0; tDir1 < Lattice::l().NeighCount(); ++tDir1) { for(Dir tDir2=0; tDir2 < Lattice::l().NeighCount(); ++tDir2) { tChange.reset(); Point l = theConf.Coord(thePos + pullDir) + Lattice::l().DirVec(tDir1); if(theConf.occupied(l))continue; Point c = theConf.Coord(thePos) + Lattice::l().DirVec(tDir2); if(theConf.occupied(c))continue; if(!Lattice::l().areNeighbors(l,c)) continue; Pos tPos = thePos; while(tPos <= Protein::p().Span()&& l!=theConf.Coord(tPos)) { tChange.add(tPos,l); if((Idx)(tPos-pullDir) <=Protein::p().Span() && Lattice::l().areNeighbors(l,theConf.Coord(tPos-pullDir))) // keeps the move local break; l=c; c=theConf.Coord(tPos); tPos-=pullDir; } mChanges.insertMem(tChange); } } } CatchError }
void BackBonePullMove::compute(Conf & theConf, Pos const thePos) { WatchError mChanges.clear(); // reset previous info if (!thePos || thePos >= Protein::p().Span()) return; Change tChange; for(Int pullDir = -1; pullDir <= 1; pullDir+=2) { for(Dir tDir1=0; tDir1 < Lattice::l().NeighCount(); ++tDir1) { for(Dir tDir2=0; tDir2 < Lattice::l().NeighCount(); ++tDir2) { for(Dir tDir3=0;tDir3<Lattice::l().NeighCount(); ++tDir3) { for(Dir tDir4=0;tDir4<Lattice::l().NeighCount(); ++tDir4) { Point l = theConf.Coord(thePos + pullDir) + Lattice::l().DirVec(tDir1); if(theConf.occupied(l))continue; Point c = theConf.Coord(thePos) + Lattice::l().DirVec(tDir2); if(theConf.occupied(c))continue; if(!Lattice::l().areNeighbors(l,c)) continue; // at this situation we also need two more positions // lS and cS that are free and not equal to c and l respectively // then we can start the pull, otherwise not // check for side chains tChange.reset(); Point lS=l+Lattice::l().DirVec(tDir3); if(theConf.occupied(lS)||lS==c)continue; Point cS=c+Lattice::l().DirVec(tDir4); if(theConf.occupied(cS)||cS==l)continue; // lS and CS cant be the same position if(lS==cS) continue; // else move possible Pos tPos = thePos; while(tPos>=0 && tPos <= (Protein::p().Length()/2-1) && l!=theConf.Coord(tPos)) { tChange.add(tPos,l); tChange.add(tPos+Protein::p().Length()/2,lS); if((Idx)(tPos-pullDir) <=(Protein::p().Length()/2-1) && (tPos-pullDir) >=0 && Lattice::l().areNeighbors(l,theConf.Coord(tPos-pullDir))) // keeps the move local break; l=c; lS=cS; c=theConf.Coord(tPos); cS=theConf.Coord(tPos+Protein::p().Length()/2); tPos-=pullDir; } mChanges.insertMem(tChange); } } } } } CatchError }