arc.alkali_atom_functions.saveCalculation#
- saveCalculation(calculation, fileName: str)[source]#
Saves calculation for future use.
Saves
calculations_atom_pairstate.PairStateInteractionsandcalculations_atom_single.StarkMapcalculations in compact binary format in file named filename. It uses cPickle serialization library in Python, and also zips the final file.Calculation can be retrieved and used with
loadSavedCalculation- Parameters:
calculation – class instance of calculations (instance of
calculations_atom_pairstate.PairStateInteractionsorcalculations_atom_single.StarkMap) to be saved.fileName – name of the file where calculation will be saved
Example
Let’s suppose that we did the part of the
calculation_atom_pairstate.PairStateInteractionscalculation that involves generation of the interaction matrix. After that we can save the full calculation in a single file:calc = PairStateInteractions(Rubidium(), 60,0,0.5, 60,0,0.5, 0.5,0.5) calc.defineBasis(0,0, 5,5, 25.e9) calc.diagonalise(np.linspace(0.5,10.0,200),150) saveCalculation(calc, "mySavedCalculation.pkl")
Then, at a later time, and even on the another machine, we can load that file and continue with calculation. We can for example explore the calculated level diagram:
calc = loadSavedCalculation("mySavedCalculation.pkl") calc.plotLevelDiagram() calc.showPlot() rvdw = calc.getVdwFromLevelDiagram(0.5,14, minStateContribution=0.5, showPlot = True)
Or, we can do additional matrix diagonalization, in some new range, then and find C6 by fitting the obtained level diagram:
calc = loadSavedCalculation("mySavedCalculation.pkl") calc.diagonalise(np.linspace(3,6.0,200),20) calc.getC6fromLevelDiagram(3,6.0,showPlot=True)
Note that for all loading of saved calculations we’ve been using function
loadSavedCalculation.Note
This doesn’t save results of
plotLevelDiagramfor the corresponding calculations. Call the plot function before callingshowPlotfunction for the corresponding calculation.