Implementation of Zipper Entanglement Renormalization on Julia platform.
Zipper.jl
uses Plots.jl
as its plotting backend, and the plotting API can be accessed via Zipper.visualize
.
One can specify the plotting backend for Plots.jl
by a specified function and with the certain backend package installed, for example the plotting backend tested in Zipper.jl
is PlotlyJS
, and we have to setup the environment before plotting data using Zipper.visualize
.
# Include the module to gain access to plotlyjs() method.
import Plots
# Specify PlotlyJS as the backend.
plotlyjs()
Before doing so one have to install PlotlyJS
via Pkg.add("PlotlyJS")
, by default PlotlyJS
is included in the Zipper.jl
package.
You can use visualize
directly with T<:FockMap
, Subset{T<:Point}
, RegionState{2}
, CrystalSpectrum{1}
, CrystalSpectrum{2}
, SnappingResult
and EigenSpectrum
.
If you want to modify the plots after they have been shown, you can use Plots.plot!
to adjust the figures.
For example modifying the size,
state::RegionState{2} = ...
visualize(state)
# Change the plot size to 800x800.
plot!(size=(800, 800))
Noted that not all functions support this feature, the notable one is Zipper.visualize(::CrystalSpectrum{2})
which utilizes mesh3d
from PlotlyJS
directly, thus the plot cannot be modified using plot!
.
Zipper.jl
by default disabled support for multithreading, by setting up multithreading environment by Zipper.setmaxthreads
it will utilize all threads available to the Julia environment to enhance the performance of many functions related to the generation or operation of type CrystalFock
and CrystalFockMap
.
ParallelTasks
defines a structure that stores the information of a set of parallel tasks.paralleltasks
is the main entry of using parallel computing inZipper.jl
, it creates an instance ofZipper.ParallelTasks
.parallel
is to execute the set of parallel tasks encapsulated byZipper.ParallelTasks
.setmaxthreads
is to control how many threads Zipper will use during computations.showtaskmeter
is to control whether the progress bar will appear when parallel computing is being performed.
Progress bars are available by default for any methods that uses the parallel computing APIs so that user can track and estimate the time required to complete the operation.
If the Julia environment in Visual Studio Code does not provide multithreading capabilities, Zipper.jl
cannot take advantage of parallel computing thus no performance enhancements will be made.
To allow Julia REPL in Visual Studio Code to use multiple threads, head to Julia settings in the settings.json
, search for the setting julia.additionalArgs
and add --threads=auto
to the list if you want Julia to decide how many threads it will use in the REPL, which most likely being the number of logical processors your native computing environment provides, or --threads=N
to manually set the N
number of threads that Julia can use. Then adjust the number of threads Zipper can use by setmaxthreads(N)
.
Zipper.jl
supports saving/loading data objects from JSON files, so that data that requires long period of computation time can be loaded with ease. This API also support defining custom
serialization rules for special data types. Noted that normal Julia types are also supported by fioload
and fiosave
.
fiodir
Set the current project directory of the session, this is the directory which all saving/loading data will be performed on.fiolower
Define a special lower function for the serialization of the object attributes, the lower function will be applied to the object beforeJSON
serializes the object into a JSON string.fioconstructor
Define a special constructor function for the deserialization of the object, the constructor function will be called after all object attributes are deserialized.fioparser
Define a special parser function for the deserialization of the object attributes, the parser function will be applied to the attribute value after the object is deserialized into aDict
.fiostoragetype
Register a storage type for the given Julia type, the storage type will be serialized instead of the actual type when saving the object to a file. During deserialization the storage type will be deserialized and converted back to the actual Julia type. Please be noted that the storage type must be a subtype ofElement
and have the functionconvert(::Type{StorageType}, ::JuliaType)
andconvert(::Type{JuliaType}, ::StorageType)
defined.fiosave
Save the givenobject
to a file with the givenname
in the current project directory defined infiodir()
, the file name will be in the format of{name}.json
.fioload
Load the object from the file with the givenname
from the current project directory defined infiodir()
, the file to be loaded will be in the path{project directory}/{name}.json
. Depands on the type some object might require extra data file to be loaded.