       err_out = nc_put_vara_double(species_wgrp_id[j], species_wspatial_id[10 + add_to_spatial_idx], start0d, count0d, &compactness);
       //energy
       dg::blas1::transform(npe[j], lnn[j], dg::LN<double>());
+      m[j]++;
     }
     //field
     arakawa.variation(field[0], helper);
     double energy[5] = {};
-    energy[0] = dg::blas2::dot(npe[0], w2d, lnn[0]);
+    energy[0] = dg::blas2::dot(lnn[0], w2d, npe[0]);
     energy[1] = p.a[1]*p.tau[1]*dg::blas2::dot(npe[1], w2d, lnn[1]);
     energy[2] = p.a[2]*p.tau[2]*dg::blas2::dot(npe[2], w2d, lnn[2]);
     energy[3] = 0.5*p.a[1]*p.mu[1]*dg::blas2::dot(npe[1], w2d, helper);

//dg::Timer t;
//t.tic();
//t.toc();
// boost::timer t;
// double duration;
//
// t.restart();
// duration = t.elapsed();

struct Heaviside2d
{ Heaviside2d( double sigma):sigma2_(sigma*sigma), x_(0), y_(0) {}

  ////////compose data////////
  const size_t num_species = 3, num_fields = 2;
  const size_t num_spatial = 14;
  const size_t num_err_time = 7, num_err_etime = 5;
  int species_rgyro_id[num_species], field_rphys_id[num_species];
  int species_wgrp_id[num_species];
  int species_wphys_id[num_species], field_wphys_id[num_fields];
