Adding new operators for the LSC-IVR

Adding a new operator to the LSC-IVR calculation is relatively easy. You just need to implement the Wigner functions and modify the parser file to handle it.

Wigner functions are implemented as functions that take a pointer to an md_calc, and return a double. As such, the .h file should include md.h. Any parameters that come from a specific potential should be stored in that potential and brought in as an extern. The temperature of the system is stored in calc->beta. Wigner functions should be stored in the lsc_ivr directory. See lsc_ivr/spinboson_wigner.* for some examples.

You should expect to add functions for the "sampler" (which will actually be the function sampled by the Monte Carlo), and for the "sampler_corrector" (if you sample function f for the Monte Carlo, then the sampler_corrector is g = AW / f). You should probably also write a function for the Wigner function as a whole (which may be equivalent to one of the others).

New operators for the LSC-IVR don't require additional lexing tokens; only new parameters withing the parser. Add support for your operator by opening lexing/md_parser.y, and looking under the comment folds for "parameters for the LSCIVR token." The statements within the if statement for the AOPTOK give choices for operator A. For each of these, you need to define the extern for lsc->opA, lsc->sampler, and lsc->sampler_corrector. For clarity, you should also use printf0 (which is a printf only for rank 0 for parallel runs) to describe the operator (useful for checking your output files).

Implementing a new choice of B operator is similarly simple. Withing the md_parser.y section of "parameters for the LSCIVR token", scroll down to the choices for the B operator. Here, things depend on whether you're taking a histogram of results (as is done for delta-function operators, for example) or doing a standard correlation function. Whichever one you're doing, you extern the function, and set it to lsc->opBhist or lsc->opBcorr as appropriate. The other should be set to point to 0x0. Finally, you should set lsc->opBtype to either opB_CORR or opB_HISTOGRAM as appropriate.

The last thing you have to do also relates to the difference between histogram B-operators and normal correlation functions. In the lsc_ivr/lsc.c file, you need to change timesampfreq depending on the situation. That variable determines how many time steps are between successive calculations of the B operator. For histograms, you want this to essentially infinite (the last time step always gets calculated) so you set it to a ridiculously high value. For normal correlation functions, it's more straightforward: usually you want to record every time step, but you can change that with this (hard-coded) parameter. [Yes, I know this shouldn't be hard-coded, but I haven't gotten around to changing that yet.]

Recompile (I suggest doing a make clean && make to be sure everything compiles) and you should now have a working program.