Skip to content

Commit

Permalink
Fixed masses and charges in NAMD
Browse files Browse the repository at this point in the history
There was an error in passing masses from NAMD to PLUMED.

Found by Glen Hocky.

Fixes #162
  • Loading branch information
GiovanniBussi committed Jul 17, 2015
1 parent 783b700 commit 25ae27a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions patches/namd-2.8.diff
Expand Up @@ -128,8 +128,8 @@ patch -u -l -b -F 5 --suffix=.preplumed "./src/ComputeMgr.C" << \EOF_EOF
+ positions[3*i+0]=coord.x;
+ positions[3*i+1]=coord.y;
+ positions[3*i+2]=coord.z;
+ masses[i]=Node::Object()->molecule->atommass(i);
+ charges[i]=Node::Object()->molecule->atommass(i);
+ masses[i]=Node::Object()->molecule->atommass(index[i]);
+ charges[i]=Node::Object()->molecule->atomcharge(index[i]);
+ };
+
+ if(spar->lattice.volume()>0.0){
Expand All @@ -141,7 +141,7 @@ patch -u -l -b -F 5 --suffix=.preplumed "./src/ComputeMgr.C" << \EOF_EOF
+
+ for(int i=0;i<forces.size();i++) forces[i]=0.0;
+
+ cmd("setMasses",&masses[0]);
+ cmd("setMasses",&masses[0]); cmd("setCharges",&charges[0]);
+ cmd("setPositions",&positions[0]);
+ cmd("setForces",&forces[0]);
+
Expand Down
6 changes: 3 additions & 3 deletions patches/namd-2.9.diff
Expand Up @@ -127,8 +127,8 @@ patch -u -l -b -F 5 --suffix=.preplumed "./src/ComputeMgr.C" << \EOF_EOF
+ positions[3*i+0]=coord.x;
+ positions[3*i+1]=coord.y;
+ positions[3*i+2]=coord.z;
+ masses[i]=Node::Object()->molecule->atommass(i);
+ charges[i]=Node::Object()->molecule->atommass(i);
+ masses[i]=Node::Object()->molecule->atommass(index[i]);
+ charges[i]=Node::Object()->molecule->atomcharge(index[i]);
+ };
+
+ if(spar->lattice.volume()>0.0){
Expand All @@ -140,7 +140,7 @@ patch -u -l -b -F 5 --suffix=.preplumed "./src/ComputeMgr.C" << \EOF_EOF
+
+ for(int i=0;i<forces.size();i++) forces[i]=0.0;
+
+ cmd("setMasses",&masses[0]);
+ cmd("setMasses",&masses[0]); cmd("setCharges",&charges[0]);
+ cmd("setPositions",&positions[0]);
+ cmd("setForces",&forces[0]);
+
Expand Down

0 comments on commit 25ae27a

Please sign in to comment.