Hi all,

I define my events like in the examples below

`ev = ({opI["x"], 10^-10} & /@ Range[2000]);`

Table[evs[i] = ev, {i, 1, 2000}];

and then I calculate the ensemble average like

`Trajectory[opI["z"], evs[i], EnsembleAverage -> {i, Range@2000}][`

opI["z"]];

or

`ev = ({opI["x"], 10^-10} & /@ Range[2000]);`

evs = ev & /@ Range[2000];

and then ensemble average

`Trajectory[opI["z"], evs[[i]], EnsembleAverage -> {i, Range@2000}][`

opI["z"]];

`SpinDynamica` uses much more RAM memory than is necessary, in both of the examples. With my 8 core computer the memory usage jumps from 3GiB to over 11GiB before the 8 cores start calculating the trajectories. The `ByteCount[]` of `evs` of the latter example is about 1.3GiB. It seems `SpinDynamica` distributes definitions of all the event lists to all 8 kernels.

In the latter example all the sub-kernels also print a harmless message

`Part::pspec: Part specification i is neither an integer nor a list of integers.`

The above problems can be fixed by replacing

`NotebookDelete[temp];`

CombineData[

Parallelize[

Table[

TransformationAmplitudeTable[

ops,

events /. varsubrules[i],

more,

Evaluate@SimplifyRules[

EnsembleAverage -> False,

OperatorBasis -> opbasis,

Basis -> basis,

ReleaseHold[Hold[opts] /. varsubrules[i]]

]

][\[Rho]ini /. varsubrules[i]],

{i, 1, nens}

],

Method -> "CoarsestGrained",

DistributedContexts -> All

],

weights,

Parallel -> False

]

with

`Table[evs[i] = events /. varsubrules[i], {i, 1, nens}];`

NotebookDelete[temp];

CombineTrajectoryFunctions[

Parallelize[

Table[

Trajectory[

ops,

evs[i],

more,

Evaluate@SimplifyRules[

EnsembleAverage -> False,

OperatorBasis -> opbasis,

Basis -> basis,

ReleaseHold[Hold[opts] /. varsubrules[i]]

]

][\[Rho]ini /. varsubrules[i]],

{i, 1, nens}

],

Method -> "CoarsestGrained",

DistributedContexts -> All

],

weights,

Sequence @@ FilterRules[

Join[{Parallel -> False, opts}, Options[Trajectory]],

Options[CombineTrajectoryFunctions]

]

]

in the ensemble average modules.

Jyrki.