Skip to content

Commit

Permalink
bug fixes in ran_solvation and ene_ana
Browse files Browse the repository at this point in the history
  • Loading branch information
hansenniels committed Dec 9, 2013
1 parent 9fbd272 commit fb98a70
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 3 additions & 1 deletion gromos++/programs/ene_ana.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ int main(int argc, char **argv){
if(iter!=args.upper_bound("time")){
dt=atof(iter->second.c_str());
usertime=true;
// a bit ugly: as the time is increased by dt before the first printout: reduce t0
t0 -= dt;
}
}

Expand Down Expand Up @@ -281,7 +283,7 @@ void print(gmath::Stat<double> &p, string s, vector<double>& time)
<< setw(15) << s
<< endl;
for(int i=0; i< p.n(); i++){
fout << setw(15) << time[i]
fout << setw(15) << time[i] << " "
<< setw(15) << p.val(i)
<< endl;
}
Expand Down
10 changes: 8 additions & 2 deletions gromos++/programs/ran_solvation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ int main(int argc, char **argv) {
// pbc:
InTopology it(args["topo_u"]);
System solu(it.system());
Box box;
Boundary *pbc = BoundaryParser::boundary(solu, args);
int truncoct = 0, rectbox = 0, cubic = 0;
double size_corr = 1.0;
Expand All @@ -255,7 +256,8 @@ int main(int argc, char **argv) {
if (minwall.size() == 0)
if (boxsize[0] != boxsize[1] || boxsize[0] != boxsize[2])
throw (gromos::Exception("ran_solvation",
"For truncated octahedral boxes, the specified boxsize should be the same in all dimensions"));
"For truncated octahedral boxes, the specified boxsize should be the same in all dimensions"));
box.setNtb(gcore::Box::truncoct);
break;
case('r'):
truncoct = 0;
Expand All @@ -265,14 +267,15 @@ int main(int argc, char **argv) {
else if (minwall.size() == 0 &&
(boxsize[0] == boxsize[1] && boxsize[0] == boxsize[2]))
cubic = 1;
box.setNtb(gcore::Box::rectangular);
break;
case('v'):
throw (gromos::Exception("ran_solvation",
"Why are you running this program if @pbc is vacuum?"));
break;
default:
stringstream msg;
msg << "Periodic boundary condition " << 'v' << " is not supported.";
msg << "Periodic boundary condition " << pbc->type() << " is not supported.";
throw gromos::Exception("ran_solvation", msg.str());
break;
}
Expand All @@ -297,6 +300,8 @@ int main(int argc, char **argv) {
ic >> solu;
ic.close();

solu.box() = box;

// shift molecule to cog
double radius_pro = calc_mol_radius(solu);
Vec shiftcog = fit::PositionUtils::shiftToCog(&solu);
Expand All @@ -320,6 +325,7 @@ int main(int argc, char **argv) {
solu.box().K()[0] = boxsize[0];
solu.box().L()[1] = boxsize[1];
solu.box().M()[2] = boxsize[2];

Vec box_mid(solu.box().K()[0] / 2.0, solu.box().L()[1] / 2.0, solu.box().M()[2] / 2.0);
fit::PositionUtils::translate(&solu, box_mid);
double vol_cell = fac_vol * boxsize[0] * boxsize[1] * boxsize[2];
Expand Down

0 comments on commit fb98a70

Please sign in to comment.