[gmx-developers] New analysis framework: trying to code a new tool

David van der Spoel spoel at xray.bmc.uu.se
Fri Mar 29 13:14:22 CET 2013


On 2013-03-29 06:19, Teemu Murtola wrote:
> Hi,
>
> You don't need to do any of this manually. You can use
> AnalysisDataPlotModule to create the output, which will write the
> output on-the-fly, without extra memory requirements. Similarly, you can
> compute the average and std.dev. using an AnalysisDataAverage module
> without coding any of that explicitly. Both of these also make them
> work with the future plans for parallelization without any
> changes. Can't say much more without seeing the rest of the code, but
> hopefully this helps.
>
> Best regards,
> Teemu

Thanks, yes I gathered so much in the end. I modeled my code on the 
distance.cpp example which allocates a plotmodule, in my code:

     AnalysisDataPlotModulePointer plotm_(new AnalysisDataPlotModule());
     plotm_->setSettings(settings.plotSettings());
     plotm_->setFileName(fnFreevol_);
     plotm_->setTitle("Free Volume");
     plotm_->setXAxisIsTime();
     plotm_->setYLabel("Free Volume (\%)");
     data_.addModule(plotm_);

however no plot file is written. Should I add something to 
finishAnalysis()? For each frame I call startFrame and finishFrame.

>
> torstai, 28. maaliskuuta 2013 David van der Spoel kirjoitti:
>
>     Hi,
>
>     I'm working my way through the documentation trying to find out some
>     stuff needed to finish my new analysis tool, to compute the free
>     volume in a box. Most of it works, but when trying to get a time
>     series I am apparently missing something.
>
>     My final writing routine looks like:
>
>     Freevolume::writeOutput()
>     {
>          AnalysisDataFrameRef ref;
>          FILE   *fp;
>          int    i;
>          double faver  = fractot_/nframes_;
>          double fsigma = sqrt(frac2tot_/nframes_-faver*__faver);
>          printf("Free volume %.2f +/- %.2f %%\n",100*faver,100*fsigma);
>          printf("Number of frames %d\n",data_.frameCount());
>          fp = fopen("koko.xvg","w");
>          for(i=0; (i<data_.frameCount()); i++)
>          {
>              ref = data_.getDataFrame(i);
>              fprintf(fp,"%g  %g\n",ref.x(),ref.y(0));
>          }
>          fclose(fp);
>     }
>
>     however, despite frameCount() yielding 101 frames, getDataFrame()
>     fails with an API error. I suspect that either I have selected the
>     wrong data type for storing the numbers
>     (__AnalysisDataFrameAverageModule__) or I have to call a routine to
>     actually get storage for frames (bool
>     gmx::AbstractAnalysisData::__requestStorage)
>
>     Any clues?
>     --
>     David van der Spoel, Ph.D., Professor of Biology
>     Dept. of Cell & Molec. Biol., Uppsala University.
>     Box 596, 75124 Uppsala, Sweden. Phone:  +46184714205.
>     spoel at xray.bmc.uu.se http://folding.bmc.uu.se
>     --
>     gmx-developers mailing list
>     gmx-developers at gromacs.org
>     http://lists.gromacs.org/__mailman/listinfo/gmx-__developers
>     <http://lists.gromacs.org/mailman/listinfo/gmx-developers>
>     Please don't post (un)subscribe requests to the list. Use the www
>     interface or send it to gmx-developers-request at gromacs.org.
>
>
>
> --
> Teemu Murtola
> <teemu.murtola at iki.fi <mailto:teemu.murtola at iki.fi>>
> +358 50 362 6829
>
>


-- 
David van der Spoel, Ph.D., Professor of Biology
Dept. of Cell & Molec. Biol., Uppsala University.
Box 596, 75124 Uppsala, Sweden. Phone:	+46184714205.
spoel at xray.bmc.uu.se    http://folding.bmc.uu.se



More information about the gromacs.org_gmx-developers mailing list