DATA ARCHIVE FOR THE ARTICLE
"Quantifying and controlling entanglement in the quantum magnet Cs2CoCl4" by
Pontus Laurell, Allen Scheie, Chiron J. Mukherjee, Michael M. Koza, Mechtild Enderle, Zbigniew Tylczynski, Satoshi Okamoto, Radu Coldea, D. Alan Tennant, and Gonzalo Alvarez
===============================================================================


This archive contains source data and plot files to replicate all figures in the article and its supplemental material, including processed experimental data and theoretical DMRG results.

All figures can be compiled using LaTeX and the PGFPlots package (http://pgfplots.sourceforge.net/) version 1.15 or later. Compilation of all figures has been tested on Windows 10 with MiKTeX 2.9, and on Linux with TeX Live 2019/Debian.

On Windows, please use the batch scripts 
compileMainFigures_Windows.bat
compileSupplementalFiguresS1-S8_S13-S15_Windows.bat
compileSupplementalFiguresS9-S12_Windows.bat
to generate the figures for the main text, and for the supplemental material, respectively. They can be executed by double clicking, or from the Command Line. Note that the combined total execution time of the scripts can exceed 1h. For this reason, we have separated out Figs. S9-S12 into their own script (listed last above), as they are particularly time consuming.



On Linux, please open a terminal and type
sh compileMainFigures_Linux.sh
sh compileSupplementalFiguresS1-S8_S13-S15_Linux.sh
sh compileSupplementalFiguresS9-S12_Linux.sh
to execute the shell (bash) scripts that generate the figures for the main text, and for the supplemental material, respectively. Note that the combined total execution time of the scripts can exceed 1h. For this reason, we have separated out Figs. S9-S12 into their own script (listed last above), as they are particularly time consuming.


The figures can also be generated manually, either from the terminal/command line or from within LaTeX editors. However, we warn that plots of neutron spectra with pgfplots can be heavy on TeX's internal memory, and that users may encounter compilation errors such as
"TeX capacity exceeded, sorry [main memory size=8000000]".
This does NOT mean pgfplots runs out of system memory, but requires a workaround. One can either compile from the terminal/command line using the flags provided in the script, or attempt to set up LaTeX editors to apply these flags automatically. Several solutions for LaTeX editors are reported at https://tex.stackexchange.com/questions/7953/how-to-expand-texs-main-memory-size-pgfplots-memory-overload
We detail the workarounds we used on Windows and on Linux at the end of this README.



CONTENTS OF THIS DIRECTORY:
===============================================================================
compileMainFigures_Linux.bat                shell (bash) script to compile figures from main article under Linux
compileSupplementalFigures_Linux.bat        shell (bash) script to compile figures from supplemental material under Linux
compileMainFigures_Windows.bat              batch script to compile figures from main article under Windows
compileSupplementalFigures_Windows.bat      batch script to compile figures from supplemental material under Windows
DMRG_Data                                   directory containing data files for numerical results for e.g. energy gap and magnetization
EntanglementData                            directory containing data files for extracted entanglement measures
ExpTwoTangle                                directory containing data files for experimental tau2 / simulated polarized experiment
figure1.tex                                 TeX file for Fig. 1 of the main text
figure2.tex         
figure3.tex
figure4.tex
figureS1.tex                                TeX file for Fig. S1 of the Supplemental Material
figureS2.tex
figureS3.tex
figureS4.tex
figureS5.tex
figureS6.tex
figureS7.tex
figureS8.tex
figureS9.tex
figureS10.tex
figureS11.tex
figureS12.tex
figureS13.tex
figureS14.tex
figureS15.tex
palette.tex                                 TeX file defining a color scheme used for line plots
PolarizationFactors                         directory containing data files for experimental polarization factor
ProcessedSpectra                            directory containing form-factor corrected experimental and DMRG spectra, used in Fig. 2, S3
README.txt                                  this file
TheoreticalSpectra                          directory containing DMRG spectra with no polarization factor applied



CONTENTS OF THE "DMRG_Data" DIRECTORY:
===============================================================================
This directory contains numerical DMRG results for some non-dynamical properties. In all files in this directory, L refers to the system size, and the field hx is given in units of J. The energies E0, E1, E2 of the three lowest states and gaps DeltaE1=E1-E0, DeltaE2=E2-E0 are provided in units of J in Delta025_Gaps_h_L100_mixedm.dat. (Divide by J=0.23 meV to obtain values for Cs2CoCl4.)

Magnetization_Delta012_h.dat and Magnetization_Delta025_h.dat contain magnetizations <0|S_i^\alpha|0> calculated from ground state runs, whereas StaggeredMagnetization_h_mixedm.dat contains magnetizations and staggered magnetizations calculated from excited state runs (using the overlap <0|(-1)^i S_i^\alpha|1>).

Finally, truncation errors from ground state runs are provided for a few different system sizes in runcationError_h_L???.dat, and plotted in Fig. S1.

Delta025_Gaps_h_L100_mixedm.dat     7 columns [L hx E0 E1 E2 DeltaE1 DeltaE2]
Magnetization_Delta012_h.dat        5 columns [L hx m^x m^y m^z]
Magnetization_Delta025_h.dat        5 columns [L hx m^x m^y m^z]
StaggeredMagnetization_h_mixedm.dat 8 columns [L hx m^x m^y m^z m^x_st m^y_st m^z_st]
TruncationError_h_L050.dat          5 columns [L hx max average sum]
TruncationError_h_L100.dat          5 columns [L hx max average sum]
TruncationError_h_L150.dat          5 columns [L hx max average sum]
TruncationError_h_L200.dat          5 columns [L hx max average sum]



CONTENTS OF THE "EntanglementData" DIRECTORY:
===============================================================================
This directory contain data files related to the entanglement measures discussed in the paper. In several of these files, the magnetic field is given both as hx in units of J, and as B in units of Tesla. Below, SvN refers to half-chain von Neumann entanglement entropy, and SR is the half-chain first Renyi entropy.

DMRG_QFI_vs_T.dat                           3 columns [hx B QFI]                plotted as "DMRG w. PF" in Fig. 4c
DMRG_QFI_vs_T_NoPolarizationFactor.dat      3 columns [hx B QFI]                plotted as "DMRG w/o PF" in Fig. 4c
DMRG_QFI_xx_vs_T.dat                        3 columns [hx B QFI]                plotted in Fig. S4
DMRG_QFI_yy_vs_T.dat                        3 columns [hx B QFI]                plotted in Fig. S4
DMRG_QFI_zz_vs_T.dat                        3 columns [hx B QFI]                plotted in Fig. S4
EntanglementEntropy_Delta012_L100_h.dat     4 columns [L hx SvN SR]             plotted in Fig. S13
EntanglementEntropy_Delta025_L050_h.dat     4 columns [L hx SvN SR]             plotted in Fig. 4
EntanglementEntropy_Delta025_L100_h.dat     4 columns [L hx SvN SR]             plotted in Fig. 4
EntanglementEntropy_Delta025_L150_h.dat     4 columns [L hx SvN SR]             plotted in Fig. 4
EntanglementEntropy_Delta025_L200_h.dat     4 columns [L hx SvN SR]             plotted in Fig. 4
Experiment_Corrected_QFI_vs_T.dat           3 columns [B QFI uncertainty]       plotted as "Corrected INS" in Fig. 4c
Experiment_Corrected_QFI_xx_vs_T.dat        2 columns [B QFIestimate]           plotted in Fig. S4
Experiment_Corrected_QFI_yy_vs_T.dat        2 columns [B QFIestimate]           plotted in Fig. S4
Experiment_Corrected_QFI_zz_vs_T.dat        2 columns [B QFIestimate]           plotted in Fig. S4
Experiment_OneTangle.dat                    2 columns [B tau1]                  plotted as "tau1 Cs2CoCl4" in Fig. 4b
Experiment_QFI_vs_T.dat                     3 columns [B QFI uncertainty]       plotted as "INS Cs2CoCl4" in Fig. 4c
QFI_vs_Delta.dat                            3 columns [Delta QFIwPF QFInoPF]    plotted in Fig. S14
QFI_vs_Size.dat                             3 columns [L QFIwPF QFInoPF]        plotted in Fig. S8
TwoTangle_h.dat                             5 columns [L h tau2 C_1' C_1'']     plotted in Fig. 4 and Fig. S6



CONTENTS OF THE "ExpTwoTangle" DIRECTORY:
===============================================================================
This directory contains data files related to Figs. S5 and S6, as well as files related to the simulated polarized experiment for fields not shown in the paper, but used to extract an estimated experimental two-tangle. Again, k is momentum along the chain given in units of 1/b. Note: the starting point for the simulated polarized experiment was the experiment_outSpectrum_*T.pgfplots files in the ProcessedSpectra directory.

CorrectionFactor_Sxx_*T.pgfplots        3 columns [k energy Px]                                 correction factor Px estimated using DMRG
CorrectionFactor_Syy_*T.pgfplots        3 columns [k energy Py]                                 correction factor Py estimated using DMRG
CorrectionFactor_Szz_*T.pgfplots        3 columns [k energy Pz]                                 correction factor Pz estimated using DMRG
experiment_Sxx_*T.pgfplots              3 columns [k energy intensity]                          approximate PF-corrected S^{xx}(k,\omega)
experiment_Syy_*T.pgfplots              3 columns [k energy intensity]                          approximate PF-corrected S^{yy}(k,\omega)
experiment_Szz_*T.pgfplots              3 columns [k energy intensity]                          approximate PF-corrected S^{zz}(k,\omega)
EXP_Gr_*T.dat                           4 columns [r g_r^x g_r^y g_r^z]                         real-space correlation functions
EXP_SQ_*T.dat                           4 columns [k Sxx(k) Syy(k) Szz(k)]                      PF-corrected static spin structure factors
EXP_TwoTangle.dat                       8 columns [B C_1' C_1'' C_2' C_2'' C_3' C_3'' tau2]     plotted in Fig. S6

The columns of EXP_TwoTangle.dat are labeled C_r' and C_r'' following Eqs. (2),(3) in the main text.



CONTENTS OF THE "PolarizationFactors" DIRECTORY:
===============================================================================
This directory contains data files for the experimental polarization factor, as plotted in Fig. S2. Energies are given in units of meV, and k is momentum along chain in units of 1/b.

Px.pgfplots         3 columns [k Energy Px]
Py.pgfplots         3 columns [k Energy Py]
Pz.pgfplots         3 columns [k Energy Pz]



CONTENTS OF THE "ProcessedSpectra" DIRECTORY:
===============================================================================
This directory contains data files for the form-factor corrected experimental INS spectra, and DMRG spectra with polarization factor and broadening applied, as plotted in Figs. 2 and S3. Those files are named *.pgfplots according to the field strength of the experiment, or converted field strength h_x/J->B(T) as described in the paper. In addition, there are .dat files containing the QFI integrand plotted in the right column of Figs. 2 and S3. For completeness, we also provide a k=pi linecut of the INS spectrum (experiment_pi_intensity_*T.dat files). The data files are structured as follows, where k is momentum along the chain in units of 1/b and energy is given in meV,

DMRG_outSpectrum_*T.pgfplots            3 columns [k energy intensity]                  plotted in middle columns of Figs. 2, S3
DMRG_pi_integrand_*T.dat                2 columns [energy intensity]                    plotted in right columns of Figs. 2, S3
experiment_outSpectrum_*T.pgfplots      4 columns [k energy intensity uncertainty]      plotted in left columns of Figs. 2, S3, [and S5(a) for zero field]
experiment_pi_integrand_*T.dat          3 columns [energy intensity uncertainty]        plotted in right columns of Figs. 2, S3
experiment_pi_intensity_*T.dat          3 columns [energy intensity uncertainty]        k=pi linecut of INS S(k,omega). Not plotted in the article.
 


CONTENTS OF THE "TheoreticalSpectra" DIRECTORY:
===============================================================================
This directory contains theoretical spectra calculated using DMRG for the 1D model, including components S^{xx}(k,\omega), S^{yy}(k,\omega), S^{zz}(k,\omega), and the overall theoretical dynamical spin structure factor S(k,\omega)=S^{xx}(k,\omega)+S^{yy}(k,\omega)+S^{zz}(k,\omega).

The first level of subdirectories are named according to the scheme DeltaABC corresponding to the anisotropy \Delta = A.BC.

The second level of subdirectories are named according to the scheme L*_h*_m*,
where   the number after L indicates system size
        the number after h indicates the field strength h_x in units of J
        the number after m indicates the maximum number of kept states (m) in the DMRG calculation 

These subdirectories each contain a subset of the following files,
Skw_inelastic.pgfplots                  3 columns [k energy intensity]      See below note about the momentum and energy units
Sxx_inelastic.pgfplots                  3 columns [k energy intensity]
Syy_inelastic.pgfplots                  3 columns [k energy intensity]
Szz_inelastic.pgfplots                  3 columns [k energy intensity]
Sxx_welastic.pgfplots                   3 columns [k energy intensity]
Syy_welastic.pgfplots                   3 columns [k energy intensity]
Szz_welastic.pgfplots                   3 columns [k energy intensity]
Sxx_inelastic_normalized.pgfplots       3 columns [k energy intensity]
Syy_inelastic_normalized.pgfplots       3 columns [k energy intensity]
Szz_inelastic_normalized.pgfplots       3 columns [k energy intensity]

1. The files S*_welastic.pgfplots are the unprocessed results from DMRG calculations, with appreciable elastic features at finite fields.
2. The files S*_inelastic.pgfplots have had these elastic features removed. These are the spectra plotted in Figs. S9-S11.
3. The files Skw_inelastic.pgfplots correspond to the sum Sxx_inelastic+Syy_inelastic+Szz_inelastic, as plotted in Fig. S12.
4. The files S*_inelastic_normalized.pgfplots only exist for hx=0, and for \Delta=0.25 and hx=hf.
To obtain these normalized spectra, we first calculated Sxx_welastic+Syy_welastic+Szz_welastic, and obtained a scale factor to enforce the sum rule.
Then that scale factor was applied proportionally to S*_welastic, and elastic features were removed, yielding S*_inelastic_normalized.pgfplots.


NOTE: These files don't all have consistent energy scales.
In most of the files, the energy is in the range [0, 3] in units of J (to check for a specific file, scroll down to bottom and look at the middle column).
However, in the Delta025 directory, the S*_inelastic.pgfplots have the energy in the range [0, 0.69] meV (obtained using J=0.23 meV for Cs2CoCl4).
In addition, the S*_inelastic_normalized.pgfplots also have the energy in the [0, 0.69] meV range for all anisotropies.

In the DMRG lattice calculation, the lattice constant is equal to one. Hence, k is in the range [0,2pi).




WORKAROUND FOR "TeX capacity exceeded, sorry" compilation error
===============================================================================
On Windows, with TeX distribution MiKTeX 2.9, we used the solution provided in https://tex.stackexchange.com/a/124206/
From the command line (cmd.exe), individual files can be compiled using
pdflatex.exe --enable-write18 --extra-mem-bot=60000000 --extra-mem-top=60000000 -synctex=1 -interaction=nonstopmode figure2.tex

To implement these switches in the TeXstudio editor, click 'Options', followed by 'Configure TeXstudio'.
Under the 'Commands' tab, we modified the pdflatex command to read
pdflatex.exe --enable-write18 --extra-mem-bot=60000000 --extra-mem-top=60000000 -synctex=1 -interaction=nonstopmode %.tex

In WinEdt 10, click 'Options', followed by 'Execution Modes'. Select pdflatex and add the following line to the 'Switches' field:
--enable-write18 --extra-mem-bot=60000000 --extra-mem-top=60000000 -synctex=1 -interaction=nonstopmode

We did not find a robust and simple way to implement this setting in the TeXworks editor.



On Linux, we used the solution provided in https://tex.stackexchange.com/a/7954/

1. In the terminal type
$ kpsewhich -a texmf.cnf

2. This gives a list of configuration files for TeX Live. In our case, we found
/usr/share/texmf/web2c/texmf.cnf
to be the relevant file path. We modified lines in that file as follows:
main_memory = 12000000       % words of inimemory available; also applies to inimf&mp
extra_mem_top = 64000000     % extra high memory for chars, tokens, etc.
extra_mem_bot = 64000000     % extra low memory for boxes, glue, breakpoints, etc.
These values were found to be sufficient, but lower values may also work.

3. In the terminal, as root run
> fmtutil-sys --all
to recreate format files.
