message: zero init gradient in setReceptor and setLigand
diff: @@ -64,6 +64,7 @@ class MolGridDataLayer : public BaseDataLayer<Dtype> {
  //make this a template mostly so I don't have to pull in gnina atom class
  mem_rec.atoms.clear();
  mem_rec.whichGrid.clear();
  + mem_rec.gradient.clear();
  //receptor atoms
  for(unsigned i = 0, n = receptor.size(); i < n; i++)
  @@ -75,8 +76,13 @@ class MolGridDataLayer : public BaseDataLayer<Dtype> {
  ainfo.y = a.coords[1];
  ainfo.z = a.coords[2];
  ainfo.w = xs_radius(t);
  + float3 gradient;
  + gradient.x = 0.0;
  + gradient.y = 0.0;
  + gradient.z = 0.0;
  mem_rec.atoms.push_back(ainfo);
  mem_rec.whichGrid.push_back(rmap[t]);
  + mem_rec.gradient.push_back(gradient);
  }
  }
  @@ -86,6 +92,8 @@ class MolGridDataLayer : public BaseDataLayer<Dtype> {
  {
  mem_lig.atoms.clear();
  mem_lig.whichGrid.clear();
  + mem_lig.gradient.clear();
  +
  //ligand atoms, grid positions offset and coordinates are specified separately
  vec center(0,0,0);
  unsigned acnt = 0;
  @@ -100,8 +108,13 @@ class MolGridDataLayer : public BaseDataLayer<Dtype> {
  ainfo.y = coord[1];
  ainfo.z = coord[2];
  ainfo.w = xs_radius(t);
  + float3 gradient;
  + gradient.x = 0.0;
  + gradient.y = 0.0;
  + gradient.z = 0.0;
  mem_lig.atoms.push_back(ainfo);
  mem_lig.whichGrid.push_back(lmap[t]+numReceptorTypes);
  + mem_lig.gradient.push_back(gradient);
  center += coord;
  acnt++;
  }
  @@ -168,8 +181,8 @@ class MolGridDataLayer : public BaseDataLayer<Dtype> {
  struct mol_info {
  vector<float4> atoms;
  - vector<float3> gradient;
  vector<short> whichGrid; //separate for better memory layout on gpu
  + vector<float3> gradient;
  vec center; //precalculate centroid, includes any random translation
  boost::array< pair<float, float>, 3> dims;
  @@ -199,8 +212,8 @@ class MolGridDataLayer : public BaseDataLayer<Dtype> {
  vector<mol_transform> batch_transform;
  boost::unordered_map<string, mol_info> molcache;
  - mol_info mem_rec; //molecular data set programmatically with setMemory
  - mol_info mem_lig; //molecular data set programmatically with setMemory
  + mol_info mem_rec; //molecular data set programmatically with setReceptor
  + mol_info mem_lig; //molecular data set programmatically with setLigand
  quaternion axial_quaternion();
  void set_mol_info(const string& file, const vector<int>& atommap, unsigned atomoffset, mol_info& minfo);
  