††thanks: These three authors contributed equally.††thanks: These three
authors contributed equally.††thanks: These three authors contributed equally.

# Crystalline and magnetic structures, magnetization, heat capacity, and
anisotropic magnetostriction effect in a yttrium-chromium oxide

Yinghao Zhu  Joint Key Laboratory of the Ministry of Education, Institute of
Applied Physics and Materials Engineering, University of Macau, Avenida da
Universidade, Taipa, Macao SAR 999078, China  Ying Fu  Joint Key Laboratory of
the Ministry of Education, Institute of Applied Physics and Materials
Engineering, University of Macau, Avenida da Universidade, Taipa, Macao SAR
999078, China  Bao Tu  Joint Key Laboratory of the Ministry of Education,
Institute of Applied Physics and Materials Engineering, University of Macau,
Avenida da Universidade, Taipa, Macao SAR 999078, China  Department of
Materials Science and Engineering, Shenzhen Key Laboratory of Full Spectral
Solar Electricity Generation (FSSEG), Southern University of Science and
Technology, No. 1088, Xueyuan Rd., Shenzhen 518055, Guangdong, China  Tao Li
Neutron Scattering Technical Engineering Research Center, School of Mechanical
Engineering, Dongguan University of Technology, Dongguan 523808, China  Jun
Miao  School of Materials Science and Engineering, University of Science and
Technology Beijing, Beijing 100083, China  Qian Zhao  Joint Key Laboratory of
the Ministry of Education, Institute of Applied Physics and Materials
Engineering, University of Macau, Avenida da Universidade, Taipa, Macao SAR
999078, China  Si Wu  Joint Key Laboratory of the Ministry of Education,
Institute of Applied Physics and Materials Engineering, University of Macau,
Avenida da Universidade, Taipa, Macao SAR 999078, China  Junchao Xia  Joint
Key Laboratory of the Ministry of Education, Institute of Applied Physics and
Materials Engineering, University of Macau, Avenida da Universidade, Taipa,
Macao SAR 999078, China  Pengfei Zhou  Joint Key Laboratory of the Ministry of
Education, Institute of Applied Physics and Materials Engineering, University
of Macau, Avenida da Universidade, Taipa, Macao SAR 999078, China  Ashfia Huq
Oak Ridge National Laboratory, Oak Ridge, Tennessee 37831, USA  Wolfgang
Schmidt  Forschungszentrum J$\ddot{u}$lich GmbH, J$\ddot{u}$lich Centre for
Neutron Science at ILL, 71 avenue des Martyrs, Grenoble 38042, France  Defang
Ouyang  State Key Laboratory of Quality Research in Chinese Medicine,
Institute of Chinese Medical Sciences (ICMS), University of Macau, Avenida da
Universidade, Taipa, Macao SAR 999078, China  Defang Ouyang  State Key
Laboratory of Quality Research in Chinese Medicine, Institute of Chinese
Medical Sciences (ICMS), University of Macau, Avenida da Universidade, Taipa,
Macao SAR 999078, China  Zikang Tang<EMAIL_ADDRESS>Joint Key Laboratory of
the Ministry of Education, Institute of Applied Physics and Materials
Engineering, University of Macau, Avenida da Universidade, Taipa, Macao SAR
999078, China  Zhubing He<EMAIL_ADDRESS>Department of Materials Science
and Engineering, Shenzhen Key Laboratory of Full Spectral Solar Electricity
Generation (FSSEG), Southern University of Science and Technology, No. 1088,
Xueyuan Rd., Shenzhen 518055, Guangdong, China  Hai-Feng Li
<EMAIL_ADDRESS>Joint Key Laboratory of the Ministry of Education,
Institute of Applied Physics and Materials Engineering, University of Macau,
Avenida da Universidade, Taipa, Macao SAR 999078, China

###### Abstract

We have studied a nearly stoichiometric insulating Y0.97(2)Cr0.98(2)O3.00(2)
single crystal by performing measurements of magnetization, heat capacity, and
neutron diffraction. Albeit that the YCrO3 compound behaves like a soft
ferromagnet with a coersive force of $\sim$0.05 T, there exist strong
antiferromagnetic (AFM) interactions between Cr3+ spins due to a strongly
negative paramagnetic Curie-Weiss temperature, i.e., –433.2(6) K. The
coexistence of ferromagnetism and antiferromagnetism may indicate a canted AFM
structure. The AFM phase transition occurs at $T_{\textrm{N}}=$ 141.5(1) K,
which increases to $T_{\textrm{N}}$(5T) = 144.5(1) K at 5 T. Within the
accuracy of the present neutron-diffraction studies, we determined a G-type
AFM structure with a propagation vector k = (1 1 0) and Cr3+ spin directions
along the crystallographic _c_ axis of the orthorhombic structure with space
group _Pnma_ below $T_{\textrm{N}}$. At 12 K, the refined moment size is
2.45(6) $\mu_{\textrm{B}}$, $\sim$82% of the theoretical saturation value 3
$\mu_{\textrm{B}}$. The Cr3+ spin interactions are probably two-dimensional
Ising like within the reciprocal (1 1 0) scattering plane. Below
$T_{\textrm{N}}$, the lattice configuration (_a_ , _b_ , _c_ , and _V_)
deviates largely downward from the Gr$\ddot{\textrm{u}}$neisen law, displaying
an anisotropic magnetostriction effect and a magnetoelastic effect.
Especially, the sample contraction upon cooling is enhanced below the AFM
transition temperature. There is evidence to suggest that the actual
crystalline symmetry of YCrO3 compound is probably lower than the currently
assumed one. Additionally, we compared the $t_{2\textrm{g}}$ YCrO3 and the
$e_{\textrm{g}}$ La7/8Sr1/8MnO3 single crystals for a further understanding of
the reason for the possible symmetry lowering.

##  I I. Introduction

Magnetic materials with ferroelectricity are very interesting because a
spontaneous electric polarization exists within them to give the substance
extraordinary physical and electronic properties and a wide variety of
applications such as data storage, catalysts, fuel cells, and sensors
Scott1998 ; Vanaken2004 ; Zhao2014 . The magnetic and ferroelectric properties
can be coupled with each other, therefore, an applied magnetic/electric field
is able to switch the electric polarization/magnetization. Above the
ferroelectric phase transition, the ferroelectric materials are usually
centrosymmetric structurally and behave as an ordinary dielectric; below the
phase transition, an electrically-polarized phase forms spontaneously with a
noncentrosymmetric structure in the weakly-coupled systems Gibbs2011  or can
be induced by a magnetic phase transition in the strongly-coupled families
Kenzelmann2005 ; Mostovoy2006 . Therefore, to build the actual structural and
magnetic models may shed light on the nature of the ferroelectric phase
transition.

Most ferroelectric materials are perovskite-based oxides. In 1954, Looby and
Katz replaced lanthanum in LaCrO3 compound with yttrium during searching for
new perovskite-type families and synthesized the YCrO3 compound with an
impurity of $\sim$2.5% Cr2O3 using NaCl as the flux under a hydrogen
atmosphere Looby1954 . Based on the observation of a very weak extra Bragg
peak, they indexed the x-ray powder-diffraction pattern with a monoclinic cell
($a=c=$ 7.61 Å, and $b=$ 7.54 Å) by doubling the fundamental perovskite unit
cell Looby1954 . One year later, the crystal structure (Fig. 1) was determined
to be orthorhombic (with space group $Pbnm$) with unit-cell constants
$a=5.238$, $b=5.518$, and $c=7.54$ Å Geller1956 . This structure becomes more
distorted as the pressure increases Ardit2010 . The lanthanide orthochromites
of general formula RECrO3 (RE = rare earth and Y) can be prepared by four
different self-propagating high-temperature syntheses Kuznetsov1998 , i.e.,
the amorphous citrate precursor method Poplawski2000 , the conventional solid-
state reaction method Westphal2000 ; Li2008 ; Zhu2019-2 , the hydrothermal
synthesis Sardar2011 , and the microwave-assisted technique Gonjal2013 .
Chemical substitution effect in the Y${}_{1-\textrm{x}}$M${}_{\textrm{x}}$CrO3
(M = Mg, Ca, Sr, Ba) compound Weber1986  and defect chemistry of the Ca-doped
YCrO3 compound Carini1991  were investigated. The YCrO3 compound in forms of
bulk and thin film was suggested to be a candidate material for high-
temperature thermistors Kagawa1997 ; Kim2003 ; Seo2015 . Among the catalysts
of ABO3-type perovskite oxides (A = La, Y, Nd, Gd; B = Fe, Mn, Cr, Co) for the
oxidation of 1,2-dichlorobenzene, the YCrO3 compound was found to be the most
active catalyst and was the only one that displayed no loss of its initial
activity after several hours on stream Poplawski2000 . The studies of
nanocrystalline (un)doped YCrO3 materials were reported Bedekar2007 ;
Bahadur2008 ; Sinha2019 . The Nd-doped YCrO3 nanoparticles display a
semiconducting feature and an enhanced dc conductivity as the Nd content
increases, following the Dyre’s free energy barrier model Sinha2019 . The
magnetic configuration of the YCrO3 compound below $T_{\textrm{N}}=$ 140 K was
proposed to be a canted antiferromagnetic (AFM) structure with antisymmetric
spin superexchanges Judin1966 ; Bertaut1966 ; Morishita1981 . It was reported
that there existed a spin reorientation of the Cr3+ moments in the YCrO3
compound at $\sim$60 K, corresponding to a rotation of the AFM easy axis
Duran2010 . Ferrimagnetism was found in the half-doped YMn0.5Cr0.5O3 compound
Hao2014 . The magnetic interactions in bulk YCrO3 compound were classified as
classical three-dimensional isotropic Heisenberg universality according to the
$ab$ $initio$ calculations and Monte Carlo simulations based on a cubic
structure with space group $Pm3m$ and lattice constant $a=$ 3.76 Å Ahmed2019 .
To understand the ferroelectric anomaly occurring at $\sim$473 K, the first-
principles density functional theory calculations found that the
noncentrosymmetric monoclinic structure (with space group $P2_{1}$) was the
stablest one in view of its lowest energy Serrao2005 . The YCrO3 compound was
reported to be a relaxor ferroelectric material at about 450 K because of the
local noncentrosymmetric structure Duran2010 . The high-temperature magnetism
(300–980 K) and crystallographic information (321–1200 K) were studied by a
time-of-flight neutron powder diffraction Zhu2019-2 , and it is of great
interest that the structural information such as lattice constants, space
group, bond angles, bond lengths, and the local distortion parameter have no
response to the dielectric anomaly observed around 473 K Serrao2005 . There
has been a long-standing debate about the decision as to which structural
symmetry is correct Looby1954 ; Geller1956 ; Ardit2010 ; Kuznetsov1998 ;
Poplawski2000 ; Westphal2000 ; Li2008 ; Zhu2019-2 ; Sardar2011 ; Gonjal2013 ;
Weber1986 ; Carini1991 ; Kagawa1997 ; Kim2003 ; Seo2015 ; Bedekar2007 ;
Bahadur2008 ; Sinha2019 ; Judin1966 ; Bertaut1966 ; Morishita1981 ; Hao2014 ;
Ahmed2019 ; Serrao2005 ; Duran2010 ; Katz1955 ; Ziel1969 ; Remeika1956 ;
Grodkiewicz1966 ; Todorov2011 ; Sugano1971 ; Zhu2019 , which necessitates a
growth of the high-quality YCrO3 single crystal Remeika1956 ; Grodkiewicz1966
; Todorov2011 ; Sugano1971 ; Zhu2019  and a careful study of its crystalline
and magnetic properties. Previously, small yttrium chromite single crystals
with millimeter in size were grown from the PbF2-B2O3 or the PbF2-B2O3-KF flux
in a platinum crucible Remeika1956 ; Grodkiewicz1966 ; Todorov2011 .

Figure 1:  Orthorhombic crystal structure (with space group $Pnma$) with one
unit cell (solid lines) and the AFM structure in one AFM unit cell with the
propagation vector at k = (1 1 0) below $T_{\textrm{N}}$ = 141.5(1) K of the
YCrO3 single crystal. The arrows on the Cr ions represent the spins of
chromium. Both the unit cells of orthorhombic and AFM structures are (_a b
c_).  Figure 2:  (a) ZFC and FC magnetization (_M_) of chromium ions in the
single-crystal YCrO3 compound as a function of temperature measured at
$\mu_{0}H=$ 0.01 T. (b) Corresponding ZFC and FC inverse magnetic
susceptibility $\chi^{-1}$ (circles) of chromium ions in the single-crystal
YCrO3 compound versus temperature. The dash-dotted line indicates a CW
behavior of the ZFC data at elevated temperatures between 200 and 300 K, which
was extrapolated to $\chi^{-1}=0$ to show the PM Curie temperature
$\theta_{\textrm{CW}}$. The fit results were listed in Table I. In (a) and
(b), $T_{\textrm{N}}=141.5$(1) K labels the AFM transition temperature at
$\mu_{0}H=$ 0.01 T, and the solid lines are guides to the eye.  Figure 3:  ZFC
magnetic hysteresis loop of the single-crystal YCrO3 compound measured at 2 K.
Inset (a) is the enlarged image of the narrow loop.  Table I: Theoretical
quantum numbers of YCrO3 compound: spin _S_ , orbital _L_ , total angular
momentum _J_ , as well as the ground-state term ${}^{2S+1}L_{J}$. Due to a
quenching by the hosted crystal field, the actual orbital angular momentum _L_
= 0 for the 3 _d_ ions in most cases, leading to the Land$\acute{\textrm{e}}$
factor $g_{J}$ = 2. We also summarized the theoretical (theo.) and measured
(meas.) [Fig. 2(b)] values of effective (eff) chromium moment
$\mu_{\textrm{eff}}$, PM Curie temperature $\theta_{\textrm{CW}}$, theoretical
saturation (sat) chromium moment $\mu_{\textrm{sat{\\_}theo.}}$, and AFM
transition N$\acute{\textrm{e}}$el temperatures ($T_{\textrm{N}}$) at
$\mu_{0}H$ = 0.01 and 5 T. The refined chromium moment size
($\mu_{\textrm{meas.}}$) at 12 K with the AFM model as shown in Fig. 1 from
our POWGEN study was listed. The numbers in parenthesis are the estimated
standard deviations of the last significant digit. A YCrO3 single crystal
---
3$d$ ion |  | Cr3+
3$d^{\textrm{n}}$ |  | 3
$S$ |  | 3/2
$L$ |  | 3
$J=L-S$ (Hund’s rule for free Cr3+) |  | 3/2
${}^{2S+1}L_{J}$ |  | ${}^{4}F_{\frac{3}{2}}$
$g_{J}$ (quenched $L$ = 0, $J$ = $S$) |  | 2
$\mu_{\textrm{eff{\\_}theo.}}=g_{J}[S(S+1)]^{\frac{1}{2}}$ $(\mu_{\textrm{B}})$ |  | 3.873
$\mu_{\textrm{sat{\\_}theo.}}=g_{J}S$ $(\mu_{\textrm{B}})$ |  | 3
$\mu_{\textrm{eff{\\_}meas.}}$ $(\mu_{\textrm{B}})$ |  | 3.95(2)
$\theta_{\textrm{CW}}$ (K) |  | –433.2(6)
$T_{\textrm{N}}$ (at 0.01 T) |  | 141.5(1)
$T_{\textrm{N}}$ (at 5 T) |  | 144.5(1)
$\mu_{\textrm{meas.}}$ (12 K, POWGEN) $(\mu_{\textrm{B}})$ |  | 2.45(6)

In this paper, we have synthesized a centimeter-sized YCrO3 single crystal
with a laser diode floating-zone (FZ) furnace Zhu2019  and performed
measurements of the chemical compositions, resistivity, and magnetization as
functions of temperature and applied-magnetic field, heat capacity, time-of-
flight neutron-powder diffraction based on a spallation neutron source, and
single-crystal neutron diffraction based on a reactor. The chemical
compositions of the grown YCrO3 single crystal are nearly stoichiometric, and
the YCrO3 compound is a robust insulator.

Figure 4:  Heat capacities of the single-crystal YCrO3 compound measured at 0
T (solid circles) and 5 T (void circles). The solid lines are guides to the
eye. Inset (a) is the enlarged image around the AFM transition temperatures.
The vertical dashed lines show the detailed transition temperatures at the
fields of 0 and 5 T. Here, $T_{\textrm{N}}$(0T) = 141.5(1) K at 0 T; by
comparison, at 5 T, $T_{\textrm{N}}$(5T) = 144.5(1) K. The solid lines are
guides to the eye.

##  II II. Experimental

The preparation of polycrystalline samples of YCrO3 compound has been
described previously in detail Zhu2019-2 . The single crystals of YCrO3
compound were grown by the FZ method Li2008  with a laser diode FZ furnace
(Model: LD-FZ-5-200W-VPO-PC-UM) Zhu2019 ; Wu2020 . We employed inductively
coupled plasma with optical emission spectroscopy (ICP-OES) analysis to
quantitatively determine chemical compositions of the investigated single
crystals.

We measured resistivity, magnetization, and heat capacity of the YCrO3 samples
with a Quantum Design physical property measurement system (PPMS DynaCool
instrument). Resistivity measurements were carried out with the standard four-
probe method at zero field from 2 to 300 K. The dc magnetization measurements
at an applied-magnetic field of 0.01 T were carried out with two modes from 5
to 295 K: One was after cooling with zero magnetic field (ZFC), and the other
was under the applied-magnetic field (FC). Magnetic hysteresis loop from 7 to
–7 T and then back to 7 T was measured at 2 K. Heat capacities were measured
at 0 (2–273 K) and 5 T (2–205 K).

We pulverized one grown YCrO3 single crystal ($\sim$4 g) with a Vibratory
Micro Mill (FRITSCH PULVERISETTE 0) and performed a time-of-flight neutron-
powder diffraction study on the POWGEN diffractometer (SNS, USA) from 12 to
302 K at 0 T. The _d_ band covers a range of 0.78–7.77 Å. Neutron holds a
magnetic moment, thus, neutron scattering is a powerful technique for solving
magnetic structures Li2009 ; Xiao2010 ; Zhang2013 ; Xiao2019 . The higher _d_
band (1.7–7.77 Å) is able to monitor all magnetic Bragg reflections that are
used to refine the low-temperature magnetic structure. Data from the lower _d_
band (0.78–3.00 Å) give indication of all possible structural phase
transitions. We analyzed all collected time-of-flight neutron-powder
diffraction data with the software of FULLPROF SUITE Rodriguez-Carvajal1993 .
We refined scale factor, lattice constants, zero epithermal shift, background,
peak profile shape, atomic positions, isotropic thermal parameters, and
preferred orientation.

Single-crystal neutron diffraction was performed at the D23 diffractometer,
located at the Institut Laue–Langevin (ILL), France.

##  III III. Results and discussion

Figure 5:  Observed (circles) and calculated (solid lines) time-of-flight
neutron-powder diffraction (NPD) patterns of a pulverized YCrO3 single
crystal, collected from the POWGEN diffractometer (SNS, USA) at 12, 145, and
300 K. The vertical bars mark the positions of nuclear (up, space group
$Pnma$) and magnetic (down, space group $P$-1) Bragg reflections, and the
lower curves represent the difference between observed and calculated
patterns.  Figure 6:  Refined chromium-moment size $M_{\textrm{ref}}$ (at 0 T)
of a pulverized YCrO3 single crystal versus temperature by the software of
FULLPROF SUITE Rodriguez-Carvajal1993 . The solid line is a guide to the eye.
Error bars are standard deviations obtained from our FULLPROF refinements in
the _Pnma_ symmetry. $T_{\textrm{N}}$ = 141.5(1) K labels the AFM transition
temperature at zero applied-magnetic field.  Figure 7:  (a) Representative
longitudinal scans of the magnetic Bragg (1 1 0) reflection at three
temperatures of 2, 195, and 300 K, from the D23 (ILL, France) study on a YCrO3
single crystal. The solid lines are guides to the eye. (b) Corresponding
temperature-dependent integrated intensities of the magnetic Bragg (1 1 0)
reflection. $T_{\textrm{N}}=141.5$(1) K labels the AFM transition temperature.
The solid line was a fit to Eqs. (2) and (4) in the affiliated thermal regime.
It was extrapolated to overall temperatures (dash-dotted line). The error bars
in (a) and (b) are the standard deviations based on our measurements and fits.
Table II: Refined structural parameters of the pulverized YCrO3 single crystal
at 12, 145, and 300 K, including lattice constants, unit-cell volume, atomic
positions, isotropic thermal parameters (_B_), bond lengths, bond angles, and
the distortion parameter $\Delta$ Zhu2019-2 . We listed the Wyckoff site of
each ion and the goodness of fit. The numbers in parenthesis are the estimated
standard deviations of the last significant digit. A pulverized YCrO3 single
crystal
---
(Orthorhombic, space group $Pnma$ (No. 62), $Z=4$)
$T$ (K) | 12 | 145 | 300
$a$ (Å) | 5.5189(1) | 5.5181(1) | 5.5198(1)
$b$ (Å) | 7.5205(1) | 7.5213(1) | 7.5297(1)
$c$ (Å) | 5.2323(1) | 5.2328(1) | 5.2392(1)
$\alpha(\beta,\gamma)$ $(^{\circ})$ | 90 | 90 | 90
$V$ (Å3) | 217.17(1) | 217.18(1) | 217.75(1)
Y(4 _c_) _x_ | 0.0682(4) | 0.0672(1) | 0.0665(1)
Y(4 _c_) _y_ | 0.25 | 0.25 | 0.25
Y(4 _c_) _z_ | –0.0172(4) | –0.0177(1) | –0.0174(2)
Y(4 _c_) _B_ (Å2) | 0.2 | 0.28(2) | 0.47(2)
Cr(4 _b_) $(x,y,z)$ | (0, 0, 0.5) | (0, 0, 0.5) | (0, 0, 0.5)
Cr(4 _b_) _B_ (Å2) | 0.2 | 0.29(3) | 0.39(3)
O1(4 _c_) _x_ | 0.4643(5) | 0.4646(2) | 0.4647(2)
O1(4 _c_) _y_ | 0.25 | 0.25 | 0.25
O1(4 _c_) _z_ | 0.1039(5) | 0.1052(2) | 0.1050(2)
O1(4 _c_) _B_ (Å2) | 0.2 | 0.34(2) | 0.51(2)
O2(8 _d_) _x_ | 0.3020(4) | 0.3020(1) | 0.3021(1)
O2(8 _d_) _y_ | 0.0539(2) | 0.0538(1) | 0.0536(1)
O2(8 _d_) _z_ | –0.3065(4) | –0.3067(1) | –0.3066(1)
O2(8 _d_) _B_ (Å2) | 0.2 | 0.34(2) | 0.51(2)
Y-O11 (Å) | 2.237(3) | 2.231(1) | 2.233(1)
Y-O12 (Å) | 2.276(4) | 2.286(1) | 2.290(1)
Y-O21 (Å) ($\times 2$) | 2.277(3) | 2.272(1) | 2.273(1)
Y-O22 (Å) ($\times 2$) | 2.476(3) | 2.479(1) | 2.485(1)
$<$Y-O$>$ (Å) | 2.337(1) | 2.337(1) | 2.340(1)
Cr-O1 (Å) ($\times 2$) | 1.967(1) | 1.969(1) | 1.971(1)
Cr-O21 (Å) ($\times 2$) | 1.983(2) | 1.983(1) | 1.984(1)
Cr-O22 (Å) ($\times 2$) | 1.992(2) | 1.991(1) | 1.993(1)
$<$Cr-O$>$ (Å) | 1.980(1) | 1.981(1) | 1.983(1)
$\angle$Cr-O1-Cr $(^{\circ})$ | 145.81(3) | 145.49(1) | 145.53(1)
$\angle$Cr-O2-Cr $(^{\circ})$ | 146.18(9) | 146.18(3) | 146.22(3)
$\Delta$(Y) $(\times 10^{-4})$ | 18.197 | 19.085 | 19.789
$\Delta$(Cr) $(\times 10^{-4})$ | 0.268 | 0.215 | 0.203
$\Delta$(O1) $(\times 10^{-4})$ | 47.429 | 47.743 | 47.930
$\Delta$(O2) $(\times 10^{-4})$ | 90.063 | 90.578 | 91.684
$R_{\textrm{p}}$ | 6.40 | 5.46 | 6.03
$R_{\textrm{wp}}$ | 9.33 | 3.67 | 3.74
$R_{\textrm{exp}}$ | 7.33 | 2.69 | 2.83
$\chi^{2}$ | 1.62 | 1.86 | 1.75

###  III.1 A. ICP-OES measurements

By quantitative ICP-OES measurements, we determined the chemical compositions
of the studied single crystal as Y0.97(2)Cr0.98(2)O3.00(2). This implies that
the resultant single crystals of YCrO3 compound by our FZ method are nearly
stoichiometric within the experimental accuracy. Therefore, during analyzing
magnetization and time-of-flight neutron-powder diffraction data, we kept the
stoichiometry of the synthesized YCrO3 samples being the ideal one (i.e.,
1:1:3).

###  III.2 B. Resistivity measurements

We tried to measure possible resistivity in the YCrO3 single crystals with a
multimeter at room temperature. Unfortunately, it was beyond the maximum range
(106 ohm) of the ohmmeter. In addition, our attempt to measure it by the
standard four-probe method with our PPMS DynaCool system from 2 to 300 K was
fruitless. Therefore, we conclude that the YCrO3 compound is a robust
insulator in our studied temperature range. A deeper understanding of the
electronic states of conducting VO Greenwood1997  and insulating YCrO3
compounds necessitates more experimental work and theoretical band structure
calculations. Perhaps both samples are the only two pure 3$d^{3}$ compounds.

###  III.3 C. Magnetization versus temperature

Fig. 2(a) shows magnetization measurements of a small piece of randomly-
orientated YCrO3 single crystal. We transferred the unit of vertical axis into
$\mu_{\textrm{B}}$ per Cr3+ ion. There exists no obvious difference between
ZFC and FC data. Upon cooling, ZFC and FC magnetization curves measured at
0.01 T show very small values down to temperature $\sim$141.5 K, e.g., ZFC
magnetization $=4.860(4)\times 10^{-7}$ and $7.310(6)\times
10^{-7}\mu_{\textrm{B}}/$Cr3+ at 295 and 142.3 K, respectively. Around 141.5
K, they increase sharply by $\sim$38$\%$ in a small thermal range of $\sim$5
K, followed by a smooth increase down to 5 K. This resembles the
characteristic feature of a reasonable canted antiferromagnet and rules out
the possibility for a ferrimagnet. At 5 K, ZFC magnetization $=4.530(4)\times
10^{-2}\mu_{\textrm{B}}/$Cr3+.

We calculated the inverse magnetic susceptibility $\chi^{-1}=\mu_{0}H/M$ as
shown in Fig. 2(b), where the nearly linear increase of $\chi^{-1}$ in the PM
state at high temperatures obeys well the molar susceptibility via a CW law

$\displaystyle\chi(T)=\frac{C}{T-\theta_{\textrm{CW}}}=\frac{N_{A}\mu^{2}_{\textrm{eff}}}{3k_{B}(T-\theta_{\textrm{CW}})},$
(1)

where _C_ is the Curie constant, $\theta_{\textrm{CW}}$ is the PM Curie
temperature, $N_{A}$ = 6.022 $\times$ 1023 mol-1 is the Avogadro’s number,
$\mu_{\textrm{eff}}$ = $g\mu_{\textrm{B}}\sqrt{J(J+1})$ is the effective PM
moment, and $k_{B}$ = 1.38062 $\times$ 10-23 J/K is the Boltzmann constant.
The fit by Eq. (1) was shown as the dash-dotted line in Fig. 2(b). The fit
parameters were listed in Table I.

Figures 2(a) and 2(b) clearly indicate a sharp magnetic phase transition. We
determined the magnetic phase transition temperature as $T_{\textrm{N}}=$
141.5(1) K. The resultant PM CW temperature $\theta_{\textrm{CW}}=$ –433.2(6)
K, indicating an existence of strong AFM correlations. We calculated the
frustrating parameter Ramirez2001 ; Ramirez1994 ; Diep2004 ; Shores2005 ;
HFLi2014 ; Li2015 , i.e., $f=\mid\theta_{\textrm{CW}}\mid/T_{\textrm{N}}=$
3.061(5), which was consistent with our high-temperature magnetization study
Zhu2019-2 . This value indicates that the low-temperature magnetic moments of
Cr3+ ions in YCrO3 compound are frustrated by competitive spin exchanges. As
listed in Table I, the extracted effective PM moment
$\mu_{\textrm{eff{\\_}meas}}=$ 3.95(2) $\mu_{\textrm{B}}$, a little bit larger
than the calculated theoretical value $\mu_{\textrm{eff{\\_}theo}}=$ 3.873
$\mu_{\textrm{B}}$, which was acceptable within the present experimental
accuracy.

###  III.4 D. Magnetization versus applied magnetic field

Figure 3 shows the measurement of magnetic hysteresis loop at 2 K. Figure 3(a)
clearly exhibits the hysteresis loop whose shape is of a parallelogram. The
loop locates in a magnetic field range of $\sim$–0.1 to 0.1 T with a coersive
force of $\sim$0.05 T and a residual magnetism of $\sim$4.54 $\times 10^{-2}$
$\mu_{\textrm{B}}$/Cr3+. These small values demonstrate that the YCrO3
compound is a soft canted antiferromagnet at low temperatures. At 2 K and 7 T,
the measured ZFC magnetization $M=9.603\times 10^{-2}\mu_{\textrm{B}}/$Cr3+.
From 0.1 to 7 T, the measured magnetization almost increases linearly with
$\chi=M/\mu_{0}H=$ 7.24(1) $\times 10^{-3}$ $\mu_{\textrm{B}}$T-1/Cr3+. We
therefore estimated that reaching a complete magnetic saturation state, an
applied-magnetic field $\mu_{0}H\geq$ $\sim$408 T is required HFLi2016 .

###  III.5 E. Heat capacity

Figure 4 shows the heat capacity measurements. At 0 T, with decreasing
temperature, the measured heat capacity decreases until $T_{\textrm{N}}=$
141.5 K, followed by an appearance of a $\lambda$-shape peak. Below this, heat
capacity continues to decrease and gets flat below $\sim$24 K. The observation
of the $\lambda$-shape peak indicates a phase transition. To reveal the nature
of the phase transition, we measured heat capacity under an applied-magnetic
field of 5 T. As shown in Fig. 4(a), at 5 T, it was noted that the intensity
of the $\lambda$-shape peak was reduced, accompanied by a shift of the peak
position from $\sim$138.8 K (0 T) to an elevated temperature $\sim$139.9 K (5
T). This is the characteristic feature of a canted antiferromagnet. Thus, the
phase transition is magnetic rather than structural. We determined
$T_{\textrm{N}}$ (5 T) = 144.5(1) K, $\sim$3 K higher than the
$T_{\textrm{N}}$ at 0 T. Quantitative analysis of the relationship between
values of $T_{\textrm{N}}$ and applied-magnetic-field strengths necessitates
more measurements. It is pointed out that with the measurement of
magnetization versus temperature, it is easy to determine the value of
$T_{\textrm{N}}$. From heat capacity measurements, the phase transition
temperature is at the temperature point at which a kink exists in the
$C_{\textrm{p}}-T$ curve as marked in Fig. 4(a).

Albeit that the magnetization and heat capacity measurements show FM behaviors
below $T_{\textrm{N}}$, the net magnetic interaction strength inside YCrO3
compound is of strongly AFM because $\theta_{\textrm{CW}}=$ –433.2(6) K,
indicating a complex low-temperature magnetic structure.

###  III.6 F. Time of flight neutron powder diffraction

To make the nature of the observed weak ferromagnetism clear and explore
possible structural phase transitions in the YCrO3 single crystal, we
performed a time-of-flight neutron-powder diffraction study. The results were
shown in Fig. 5. At the three temperatures as labeled, i.e., below (12 K),
around (145 K), and above (300 K) the magnetic transition temperature
($\sim$141.5 K), all time-of-flight neutron-powder diffraction patterns were
well indexed by an orthorhombic structure with the space group _Pnma_. There
was no detectable peak splitting or an appearance of satellite reflections.
This indicates that no structural phase transition occurs in the YCrO3 single
crystal as a function of temperature in the studied thermal regime. This is in
agreement with our heat capacity measurements. Based on the observed magnetic
Bragg (0 1 1) and (1 1 0) peaks, as labeled in the right-bottom of Fig. 5, we
established an AFM model with the propagation vector at k = (1 1 0) and the
moment directions along the crystallographic _c_ axis. The extracted magnetic
structure was schematically drawn in Fig. 1. It is pointed out that the
magnetic (1 1 0) reflection is structurally forbidden by the space group
_Pnma_. We tried all possible canted AFM models, unfortunately, the
corresponding FULLPROF refinements were not successful. The refined structural
parameters were listed in Table II. It is pointed out that for the refinement
of the data at 12 K, we constrained the isotropic thermal parameters (_B_) of
Y, Cr, O1, and O2 ions being the same as 0.2.

Within the present experimental accuracy, we can only determine a G-type AFM
structure as shown in Fig. 1, where the nearest-neighbor Cr3+ spins are
aligned antiparallel. The directions of the AFM submoments are along with the
crystallographic _c_ axis, i.e., the direction with the smallest lattice
constant. It is hard to determine the possible canting angle. It was suggested
that including a spin-orbital coupling on the quenched Cr3+ ground state, an
antisymmetric exchange interaction would cant the AFM moments along the
crystallographic _b_ axis, i.e., the direction with the largest lattice
constant, according to the Dzialoshinski-Moriya theory Cooke1974 . This leads
to an appearance of the weak ferromagnetism.

Figure 6 shows the refined moment size of Cr3+ ions in the YCrO3 single
crystal, extracted from our time-of-flight neutron-powder diffraction study.
As listed in Table I, the refined moment size at 12 K is 2.45(6)
$\mu_{\textrm{B}}$, $\sim$82% of the theoretical saturation moment (3
$\mu_{\textrm{B}}$), in agreement with our conclusion that there exists a
magnetic frustration in YCrO3 compound and the studies with x-ray magnetic
circular dichroism and absorption spectroscopies Ahmed2019  where the computed
values of spin and orbital moments are 2.38 $\mu_{\textrm{B}}$ and –0.094
$\mu_{\textrm{B}}$, respectively, and that the total magnetic moment has
little contribution from the orbital component. As temperature increases, the
refined moment size remains a plateau up to $\sim$50 K, followed by a gradual
diminution with temperature upon warming until a radical disappearance around
141.5 K, the onset temperature of the AFM transition (Figs. 2 and 6). Above
$T_{\textrm{N}}$ (0 T) = 141.5 K, intensities of the two magnetic Bragg
reflections were undetectable.

Figure 8:  Subtracted integrated intensity from the pure magnetic contribution
at the Bragg (1 1 0) peak position (void pentagons), to see detailed analysis
in the text. Inset (a) shows the enlarged image around $T_{\textrm{N}}$ from
132–145 K. The solid line was a fit to the power-law Eq. (5) in the affiliated
thermal regime. The error bars are the propagated standard deviations based on
our calculations.

###  III.7 G. Single crystal neutron diffraction

An orientated YCrO3 single crystal with the (_H_ _K_ 0) reciprocal-lattice
vector in the scattering plane was used to perform a single-crystal neutron
diffraction study on the D23 single-crystal diffractometer (ILL, France).
Figure 7(a) shows some longitudinal scans of the magnetic Bragg (1 1 0)
reflection. At 2 K (below $T_{\textrm{N}}$), we observed a very strong peak,
indicating a formation of the AFM structure. At 195 and 300 K (above
$T_{\textrm{N}}$), the intensity of the magnetic (1 1 0) peak decreased
sharply but did not disappear. It is interesting that there still exists
detectable intensity of the Bragg (1 1 0) peak above $T_{\textrm{N}}$. We
ruled out the $\lambda/2$ contamination. As the foregoing remark, this
reflection is forbidden by the space group _Pnma_. Therefore, the existence of
the Bragg (1 1 0) reflection above $T_{\textrm{N}}$ indicates that the actual
crystalline structure of YCrO3 compound may be lower than the orthorhombic
structure with space group _Pnma_. Our studies also demonstrate that the
scattering ability of a single crystal is much higher than that of the
corresponding pulverized powder sample.

At 195 and 300 K, the observed Bragg (1 1 0) reflection forbidden structurally
by the _Pnma_ symmetry was treated to be from a pure nuclear contribution. The
temperature variation of this contribution depends mainly on the thermal
dynamic vibrations of related atoms, i.e., Debye-Waller (DW) factors. The
falloff of the temperature-weakened intensity at a certain scattering vector
_Q_ almost decays exponentially and can be estimated by

$\displaystyle I=I_{0}e^{-2W(Q,T)},$ (2)

where the exponential part is the DW factor, and

$\displaystyle 2W(Q,T)=\frac{\hbar^{2}Q^{2}}{2\textrm{M}}\int
coth\left(\frac{\hbar\omega}{2k_{B}T}\right)\frac{Z(\omega)}{\omega}d\omega,$
(3)

where $\hbar$ = 1.054589 $\times$ 10-34 J.s is the Planck constant divided by
2$\pi$, M is the atomic mass, and $Z(\omega)$ is the phonon density of states
Stephen1984 . At high temperatures, it is given simply by

$\displaystyle
2\emph{W}=\frac{3\hbar^{2}Q^{2}}{\textrm{M}k_{B}\Theta^{2}_{W}}T,$ (4)

where $\Theta_{W}$ is the effective Debye temperature Kittel1987 . Therefore,
we treated practically the DW factor with a linear response to temperature, as
verified in previous studies Li2007_1 ; Li2007_2 ; Tari2003 ; Li2014Er . We
fit the integrated intensities of the Bragg (1 1 0) reflection above
$T_{\textrm{N}}$ to Eqs. (2) and (4), shown as the solid line in Fig. 7(b),
and extrapolated the fit to the entire temperature range (shown as the dash-
dotted line).

Figure 9:  (a) Temperature-dependent lattice constants _a_ , _b_ , and _c_ of
a pulverized YCrO3 single crystal. (b) Corresponding anomalous unit-cell
volume _V_ expansion with temperature. The solid lines in (a) and (b) are
theoretical estimates of the variation of structural parameters using the
Gr$\ddot{\textrm{u}}$neisen model with Debye temperature of
$\theta_{\textrm{D}}$ = 580 K that is the same value as the one reported
previously Zhu2019-2 . $T_{\textrm{N}}$ = 141.5(1) K labels the AFM transition
temperature. The error bars in (a) and (b) are the standard deviations
obtained from our FULLPROF refinements with the _Pnma_ structural symmetry.
Figure 10:  (a) Three bond lengths of Mn-O1, Mn-O21, and Mn-O22 in the
La${}_{\frac{7}{8}}$Sr${}_{\frac{1}{8}}$MnO3 single crystal Li2009  versus
temperature. $T_{\textrm{JT}}$ $\approx$ 180–270 K denotes the regime of the
Jahn-Teller effect. (b) Corresponding bond lengths in the YCrO3 single crystal
as a function of temperature from this study. $T_{\textrm{N}}=141.5$(1) K
labels the AFM transition temperature. The error bars in (a) and (b) were from
our FULLPROF refinements.  Figure 11:  Schematic illustration of the three
Cr-O bonds (Cr-O1, Cr-O21, and Cr-O22), as well as the two bond angles Cr-O-Cr
(Cr-O1-Cr and Cr-O2-Cr) in the orthorhombic structure of a YCrO3 single
crystal. In this structural symmetry (with space group _Pnma_), Cr ions in
YCrO3 compound have the same Wyckoff site, 4 _b_ (0 0 0.5), as that of the Mn
ions in La${}_{\frac{7}{8}}$Sr${}_{\frac{1}{8}}$MnO3 compound Li2007_1 ;
Li2007_2 ; Li2009 ; Li2008 .  Figure 12:  (a) Temperature-dependent bond
angles of Mn-O1-Mn and Mn-O2-Mn in the
La${}_{\frac{7}{8}}$Sr${}_{\frac{1}{8}}$MnO3 single crystal Li2009 .
$T_{\textrm{JT}}$ $\approx$ 180–270 K denotes the regime of the Jahn-Teller
effect. (b) Temperature-dependent bond angles of Cr-O1-Cr and Cr-O2-Cr in the
YCrO3 single crystal from the present study. $T_{\textrm{N}}=141.5$(1) K
labels the AFM transition temperature. The error bars in (a) and (b) are the
standard deviations from refinements. The solid lines in (a) and (b) are
guides to the eye.  Figure 13:  Comparison of the averaged bond lengths of Y-O
in YCrO3 (left, from the present study) and La-O in
La${}_{\frac{7}{8}}$Sr${}_{\frac{1}{8}}$MnO3 Li2009  (right) single crystals.
$T_{\textrm{JT}}$ $\approx$ 180–270 K denotes the regime of the Jahn-Teller
effect of La${}_{\frac{7}{8}}$Sr${}_{\frac{1}{8}}$MnO3 compound.
$T_{\textrm{N}}=141.5$(1) K labels the AFM transition temperature of YCrO3
compound. The error bars are the calculated standard deviations. The solid
lines are guides to the eye. It is clear that the bond length of
$\langle$Y-O$\rangle$ is shorter than that of the $\langle$La-O$\rangle$ bond
beyond statistics.

Furthermore, we subtracted the corresponding nuclear component from the total
scattered intensity at the Bragg (1 1 0) peak position to extract the pure
magnetic contribution below $T_{\textrm{N}}$ as shown in Fig. 8. The resultant
magnetic intensity above $T_{\textrm{N}}$ is approximately zero within
accuracy, which in turn supports the above subtraction. The extracted
integrated intensity (_I_) of Bragg (1 1 0) reflection from the pure magnetic
contribution can be fit to a power-law equation Collins1989 ; Payne1996

$\displaystyle
I(T)=I_{0}\left(\frac{|T-T_{\textrm{N}}|}{T_{\textrm{N}}}\right)^{2\beta},$
(5)

where $T_{\textrm{N}}$ is the value of the Néel temperature, and $\beta$ is
the critical exponent. Our fit with Eq. (5) to the extracted data in a narrow
thermal range from 125 to 140 K, shown as the solid line in Fig. 8, produces a
N$\acute{\textrm{e}}$el temperature $T_{\textrm{N1}}=$ 140.0(1) K, and the
critical exponent $2\beta=$ 0.215(6), indicating a second-order type phase
transition and probably two-dimensional Ising-like spin interactions existing
within the reciprocal (1 1 0) scattering plane Collins1989 ; Xiao2010 . The
fitting procedure was as follow: First, we kept $I_{0}=$ 80 and
$T_{\textrm{N}}=$ 141.5 K and allowed $\beta$ to vary; finally, we fit all
parameters together. For comparison, we further fit the data in three
temperature ranges of 125–140 K, 130–140 K, and 135–140 K. No clear
differences exist in the values of the refined $T_{\textrm{N}}$ and $\beta$,
which validates our choice of the temperature range of 125–140 K for the final
fitting.

As shown in Fig. 8(a), it is interesting to note that above $T_{\textrm{N1}}$,
there exists weaker critical scattering over a range of temperature up to 145
K.

###  III.8 H. Anisotropic magnetostriction effect

The refined lattice parameters _a_ , _b_ , and _c_ , as well as the unit-cell
volume _V_ , from our time-of-flight neutron-powder diffraction studies were
shown in Fig. 9 (void symbols). Upon cooling, the refined (Re) _a_ , _b_ , _c_
, and _V_ almost shrink linearly down to $T_{\textrm{N}}$ at which a cusp
appears.

As in the foregoing discussions, the YCrO3 compound is an insulator. We thus
neglected the electronic contribution to the thermal expansion of its lattice
configuration ($\varepsilon$). The temperature variation of the nonmagnetic
contribution component is then mainly from phonons. This can approximately be
estimated according to the Gr$\ddot{\textrm{u}}$neisen rules at zero pressure
with a second-order fashion Li2012 ; Wallace1998 ; Vocadlo2002

$\displaystyle\varepsilon(T)=\varepsilon_{0}+\varepsilon_{0}\frac{U}{Q-BU},$
(6)

where $\varepsilon_{0}$ is the lattice parameter at zero Kelvin, and the
internal energy _U_ can be calculated with the Debye approximations

$\displaystyle
U(T)=9Nk_{B}T\left(\frac{T}{\Theta_{D}}\right)^{3}\int^{\frac{\Theta_{D}}{T}}_{0}\frac{x^{3}}{e^{x}-1}dx,$
(7)

where _N_ = 5 is the number of atoms per formula unit, and $\Theta_{D}$ is the
Debye temperature. With Eqs. (6) and (7), we fit the lattice parameters of
YCrO3 compound in the PM state (above $T_{\textrm{N}}$ $\approx$ 141.5 K) and
extrapolated the fits to overall temperatures as shown in Fig. 9 (solid
lines). For example, the fitting for the unit-cell volume _V_ results in
$V_{0}$ $\approx$ 217.14 Å3, _Q_ $\approx$ 7.57 $\times$ 10-18 J, and _B_
$\approx$ –40.73. The different variations in _a_ , _b_ , and _c_ below
$T_{\textrm{N}}$ in contrast to our theoretical estimates by the
Gr$\ddot{\textrm{u}}$neisen (Gr) law Wallace1998 ; Vocadlo2002  (solid lines),
e.g.,
$\frac{a^{\textrm{12K}}_{\textrm{Re}}-a^{\textrm{12K}}_{\textrm{Gr}}}{a^{\textrm{12K}}_{\textrm{Gr}}}$
$\approx$ –2.73 $\times$ 10-4,
$\frac{b^{\textrm{12K}}_{\textrm{Re}}-b^{\textrm{12K}}_{\textrm{Gr}}}{b^{\textrm{12K}}_{\textrm{Gr}}}$
$\approx$ –2.19 $\times$ 10-4, and
$\frac{c^{\textrm{12K}}_{\textrm{Re}}-c^{\textrm{12K}}_{\textrm{Gr}}}{c^{\textrm{12K}}_{\textrm{Gr}}}$
$\approx$ –2.67 $\times$ 10-4, indicate an anisotropic magnetostriction effect
and that magnetic anisotropy exists in YCrO3 compound. Below $T_{\textrm{N}}$,
the magnetically-driven additional decreases of _a_ , _b_ , and _c_ jointly
result in an enhanced sample contraction upon cooling, e.g.,
$\frac{V^{\textrm{12K}}_{\textrm{Re}}-V^{\textrm{12K}}_{\textrm{Gr}}}{V^{\textrm{12K}}_{\textrm{Gr}}}$
$\approx$ –7.43 $\times$ 10-4, signifying a magnetoelastic effect Li2011  and
a localized nature of the $t_{2\textrm{g}}$ moments, opposite the case in the
GdSi metallic compound Li2012 .

###  III.9 I. Comparison between $t_{2\textrm{g}}$ YCrO3 and $e_{\textrm{g}}$
La7/8Sr1/8MnO3 compounds

As shown in Fig. 10, it is of interest to compare the bond lengths of the 3
_d_ Mn3+/Mn4+
($e^{1}_{\textrm{g}}t^{3}_{2\textrm{g}}$/$e^{0}_{\textrm{g}}t^{3}_{2\textrm{g}}$)
ions in La${}_{\frac{7}{8}}$Sr${}_{\frac{1}{8}}$MnO3 compound Li2009 ;
Kotani2017  with those of the Cr3+ ($e^{0}_{\textrm{g}}t^{3}_{2\textrm{g}}$)
ions in YCrO3 compound. The structural parameters of
La${}_{\frac{7}{8}}$Sr${}_{\frac{1}{8}}$MnO3 compound Li2009  were from a
neutron-powder diffraction study on samples pulverized from a single crystal.
This is thus comparable to the results from the present study. Both bond
lengths of Mn-O21 and Mn-O22 [Fig. 10(a)] and the bond angle of Mn-O1-Mn [Fig.
12(a)] respond readily to the Jahn-Teller effect that occurs in
La${}_{\frac{7}{8}}$Sr${}_{\frac{1}{8}}$MnO3 compound within a temperature
range of $\sim$180–270 K, whereas, those in YCrO3 compound keep nearly
constants, and both Cr-O bond lengths [Fig. 10(b)] and Cr-O-Cr bond angles
[Fig. 12(b)] exhibit no response to the AFM transition, consistent with the
fact that Cr3+ ions don’t have the Jahn-Teller effect. The values of Cr-O1
bond lengths are similar to those of the Mn-O21, and Cr-O21 and Cr-O22 to
Mn-O1 (Fig. 10).

As shown in Figs. 11 and 12, in contrast to the bond angle of Mn-O-Mn,
$\angle$Cr-O-Cr decreases hugely by $\sim$15∘, which in our opinion
corresponds intimately to a possible lowering of the crystalline symmetry in
the YCrO3 single crystal. The relatively shorter bond length of
$\langle$Y-O$\rangle$ (Fig. 13) introduces an immense mismatch between Y3+ and
Cr3+ sites, leading to a huge chemical pressure and driving the subsequent
rotating and tilting of the CrO6 octahedra.

##  IV IV. Conclusions

In summary, we have grown a nearly stoichiometric Y0.97(2)Cr0.98(2)O3.00(2)
single crystal by a laser diode FZ furnace. There are three electrons locating
on the 3 _d_ $t_{\textrm{2g}}$ orbitals of Cr3+ ions, therefore, the YCrO3
compound is a robust insulator. Although the measurements of the applied-
magnetic-field dependent heat capacity as well as the magnetization versus
temperature and applied-magnetic field show the character of a very soft
ferromagnet with a coersive force of $\sim$0.05 T, the extracted PM CW
temperature, $\theta_{\textrm{CW}}=$ –433.2(6) K, by the fit with a CW law is
strongly negative with the frustrating parameter
$f=\mid\theta_{\textrm{CW}}\mid/T_{\textrm{N}}=$ 3.061(5), and the measured
magnetization at 2 K and 7 T is only $\sim$3.2% of the theoretical saturation
moment. These indicate that the spin moments of Cr3+ ions in YCrO3 compound
are magnetically frustrated. The consistency between the effective PM moment,
$\mu_{\textrm{eff{\\_}meas}}=$ 3.95(2) $\mu_{\textrm{B}}$, and the
theoretically-calculated value, $\mu_{\textrm{eff{\\_}theo}}=$ 3.873
$\mu_{\textrm{B}}$, validates our results concluded in the framework of the
CW-law fitting. By magnetization measurements, we determined the magnetic
phase transition temperature as $T_{\textrm{N}}=$ 141.5(1) K at an applied-
magnetic field of 0.01 T. This is in agreement with our neutron-powder and
single-crystal diffraction studies. The magnetic transition temperature was
pushed upward to $T_{\textrm{N}}$(5T) = 144.5(1) K at 5 T, increased by
$\sim$3 K.

With our neutron-powder diffraction study, we have established an AFM
structure with the propagation vector at k = (1 1 0) and the same unit cell as
that of the crystalline structure (with space group $Pnma$). The direction of
the Cr3+ spin moments is along the crystallographic _c_ axis. The refined
moment size is 2.45(6) $\mu_{\textrm{B}}$ at 12 K, $\sim$82% of the
theoretical saturation value 3 $\mu_{\textrm{B}}$. This is consistent with the
fact that a magnetic frustration exists in YCrO3 compound. By fitting
integrated intensities of the magnetic Bragg (1 1 0) reflection extracted from
the pure magnetic contribution with a power law, we found that the Cr3+ spin
interactions were probably two-dimensional Ising like within the reciprocal (1
1 0) scattering plane. Above $T_{\textrm{N}}=$ 141.5(1) K, the refined lattice
constants _a_ , _b_ , and _c_ , as well as the unit-cell volume _V_ , agree
well with the Gr$\ddot{\textrm{u}}$neisen rules at zero pressure with a
second-order fashion. By comparison, below $T_{\textrm{N}}$, the lattice
configuration (_a_ , _b_ , _c_ , and _V_) deviates largely downward from the
Gr$\ddot{\textrm{u}}$neisen law, displaying an anisotropic magnetostriction
effect along the crystallographic _a_ , _b_ , and _c_ axes and a
magnetoelastic effect with the unit-cell volume _V_. Especially, upon cooling,
the sample contraction is enhanced below $T_{\textrm{N}}$.

In the whole studied temperature range of 12–302 K, we did not find any
crystalline structural phase transition with the neutron-powder diffraction
study, whereas by our single-crystal neutron diffraction study, we observed
clearly the existence of the Bragg (1 1 0) peak above the magnetic phase
transition temperature 141.5(1) K. This peak persists up to 300 K and is
forbidden by the crystalline orthorhombic structure (with space group $Pnma$).
This implies that the actual crystalline structure of YCrO3 compound is
probably lower than the present one. To figure out the reasons for a possible
lowering of the structural symmetry in the YCrO3 single crystal, we compared
the $t_{2\textrm{g}}$ YCrO3 and the $e_{\textrm{g}}$ La7/8Sr1/8MnO3 single
crystals. It is pointed out that with a limited number of the observed
magnetic Bragg peaks, it is hard to determine the canting degree of the AFM
Cr3+ spins. This can be addressed by a further time-of-flight single-crystal
neutron-diffraction study. To determine the actual crystalline structure is
not an easy job, but it would shed light on the dielectric anomaly of YCrO3
compound.

##  V Acknowledgements

T.L. acknowledges the National Natural Science Foundation of China (Grant No.
11604214), the Foundation of Department of Education of Guangdong Province
(Grant No. 2018KTSCX223), and the Foundation of Department of Science and
Technology of Guangdong Province (Grant No. 2020A1515010814). J.M.
acknowledges the National Science Foundation of China (Grant No. 11974042).
D.O. acknowledges financial support from the Science and Technology
Development Fund, Macao SAR (File No. 0029/2018/A1). H.-F.L. acknowledges the
University of Macau (Files No. SRG2016–00091–FST and No.
MYRG2020–00278–IAPME), the Science and Technology Development Fund, Macao SAR
(Files No. 063/2016/A2, No. 064/2016/A2, No. 028/2017/A1, and No.
0051/2019/AFJ), and the Guangdong–Hong Kong–Macao Joint Laboratory for Neutron
Scattering Science and Technology. This research used resources at the
Spallation Neutron Source, a Department of Energy Office of Science User
Facility operated by Oak Ridge National Laboratory.

## References

  * (1) O. Auciello, J. F. Scott, and R. Ramesh, Phys. Today 51, 22 (1998).
  * (2) B. B. Vanaken, T. T. M. Palstra, A. Filippetti, and N. A. Spaldin, Nat. Mater. 3, 164 (2004).
  * (3) H. J. Zhao, W. Ren, Y. Yang, J. $\acute{\textrm{I}}$$\tilde{\textrm{n}}$iguez, X. M. Chen, and L. Bellaiche, Nat. Commun. 5, 4021 (2014).
  * (4) A. S. Gibbs, K. S. Knight, and P. Lightfoot, Phys. Rev. B 83, 094111 (2011).
  * (5) M. Kenzelmann, A. B. Harris, S. Jonas, C. Broholm, J. Schefer, S. B. Kim, C. L. Zhang, S.-W. Cheong, O. P. Vajk, and J. W. Lynn, Phys. Rev. Lett. 95, 087206 (2005).
  * (6) M. V. Mostovoy, Phys. Rev. Lett. 96, 067601 (2006).
  * (7) J. T. Looby and L. Katz, J. Am. Chem. Soc. 76, 6029 (1954).
  * (8) S. Geller and E. A. Wood, Acta Cryst. 9, 563 (1956).
  * (9) M. Ardit, G. Cruciani, M. Dondi, M. Merlini, and P. Bouvier, Phys. Rev. B 82, 064109 (2010).
  * (10) M. V. Kuznetsov and I. P. Parkin, Polyhedron 17, 4443 (1998).
  * (11) K. Poplawski, K. Schnitzlein, J. Lichtenberger, F. J. Keil, and M. D. Amiridis, Catal. Today 62, 329 (2000).
  * (12) D. Westphal, A. Laske, S. Jakobs, and U. Guth, Ionics 6, 346 (2000).
  * (13) H. Li, Synthesis of CMR manganites and ordering phenomena in complex transition metal oxides (Forschungszentrum J$\ddot{\rm u}$lich GmbH Press, J$\ddot{\rm u}$lich, 2008).
  * (14) Y. Zhu, S. Wu, B. Tu, S. Jin, A. Huq, J. Persson, H. S. Gao, D. Ouyang, Z. B. He, D.-X. Yao, Z. K. Tang, and H.-F. Li, Phys. Rev. B 101, 014114 (2020).
  * (15) K. Sardar, M. R. Lees, R. J. Kashtiban, J. Sloan, and R. I. Walton, Chem. Mater. 23, 48 (2011).
  * (16) J. Prado-Gonjal, R. Schmidt, J.-J. Romero, D. $\acute{\textrm{A}}$vila, U. Amador, and E. Mor$\acute{\textrm{a}}$n, Inorg. Chem. 52, 313 (2013).
  * (17) W. J. Weber, C. W. Griffin, and J. L. Bates, J. Mater. Res. 1, 675 (1986).
  * (18) G. F. Carini II, H. U. Anderson, D. M. Sparlin, and M. M. Nasrallah, Solid State lonics 49, 233 (1991).
  * (19) M. Kagawa, Y. Kato, and Y. Syono, J. Aeroso Sci. 28, 475 (1997).
  * (20) J. H. Kim, H.-S. Shin, S.-H. Kim, J.-H. Moon, and B.-T. Lee, Jpn. J. Appl. Phys. 42, 575 (2003).
  * (21) J. Seo, Y. Ahn, and J. Y. Son, Ceram. Int. 41, 12471 (2015).
  * (22) V. Bedekar, R. Shukla, and A. K. Tyagi, Nanotechnology 18, 155706 (2007).
  * (23) J. Bahadur, D. Sen, S. Mazumder, R. Shukla, and A. K. Tyagi, J. Phys. Condens. Mat. 20, 345201 (2008).
  * (24) R. Sinha, S. Basu, and A. K. Meikap, Phys. E Low-Dimens. Syst. Nanostruct. 113, 194 (2019).
  * (25) V. M. J$\ddot{\rm u}$din and A. B. Sherman, Solid State Commun. 4, 661 (1966).
  * (26) E. F. Bertaut, G. Bassi, G. Buisson, P. Burlet, J. Chappert, A. Delapalme, J. Mareschal, G. Roult, R. Aleonard, R. Pauthenet, and J. P. Rebouillat, J. Appl. Phys. 37, 1038 (1966).
  * (27) T. Morishita and K. Tsushima, Phys. Rev. B 24, 341 (1981).
  * (28) A. Dur$\acute{\textrm{a}}$n, A. M. Ar$\acute{\textrm{e}}$valo-L$\acute{\textrm{o}}$pez, E. Castillo-Martínez, M. García-Guaderrama, E. Moran, M. P. Cruz, F. Fern$\acute{\textrm{a}}$ndez, and M. A. Alario-Francob, J. Solid State Chem. 183, 1863 (2010).
  * (29) L. Hao, L. Yang, M.-H. Lee, T.-H. Lin, Z. Zhang, X. Xie, and H. Zhu, J. Alloys Compd. 601, 14 (2014).
  * (30) S. Sidi Ahmed, G. D. Ngantso, M. Boujnah, A. Benyoussef, and A. El Kenz, Phys. Lett. A 383, 121 (2019).
  * (31) C. R. Serrao, A. K. Kundu, S. B. Krupanidhi, U. V. Waghmare, and C. N. R. Rao, Physical Review B 72, 220101(R) (2005).
  * (32) L. Katz, Acta Cryst. 8, 121 (1955).
  * (33) J. P. Van Der Ziel and L. G. Van Uitert, Phys. Rev. 179, 343 (1969).
  * (34) J. P. Remeika, J. Am. Chem. Soc. 78, 4259 (1956).
  * (35) W. H. Grodkiewicz and D. J. Nitti, J. Am. Ceram. Soc. 49, 576 (1966).
  * (36) N. D. Todorov, M. V. Abrashev, V. G. Ivanov, G. G. Tsutsumanova, V. Marinova, Y.-Q. Wang, and M. N. Iliev, Phys. Rev. B 83, 224303 (2011).
  * (37) S. Sugano, K. Aoyagi, and K. Tsushima, J. Phys. Soc. Jpn. 31, 706 (1971).
  * (38) Y. H. Zhu, S. Wu, Z. K. Tang, and H.-F. Li, _A method of centimeter-sized single crystal growth of chromate compounds and related storage device_ , China Patent No. 201911281088.8, (2019).
  * (39) S. Wu, Y. H. Zhu, H. S. Gao, Y. Xiao, J. C. Xia, P. F. Zhou, D. F. Ouyang, Z. Li, Z. Q. Chen, Z. K. Tang, and H.-F. Li, ACS Omega 5, 16584 (2020).
  * (40) H.-F. Li, Y. Su, Y. G. Xiao, J. Persson, P. Meuffels, and Th. Brückel, Eur. Phys. J. B 67, 149 (2009).
  * (41) Y. Xiao, Y. Su, H.-F. Li, C. M. N. Kumar, R. Mittal, J. Persson, A. Senyshyn, K. Gross, and Th. Brueckel, Phys. Rev. B 82, 094437 (2010).
  * (42) Q. Zhang, W. Tian, H. Li, J.-W. Kim, J. Yan, R. W. McCallum, T. A. Lograsso, J. L. Zarestky, S. L. Bud′ko, R. J. McQueeney, and D. Vaknin, Phys. Rev. B 88, 174517 (2013).
  * (43) W. H. Ji, L. Yin, W. M. Zhu, C. M. N. Kumar, C. Li, H.-F. Li, W. T. Jin, S. Nandi, X. Sun, Y. Su, Th. Br$\ddot{\rm u}$ckel, Y. Lee, B. N. Harmon, L. Ke, Z. W. Ouyang, and Y. Xiao, Phys. Rev. B 100, 134420 (2019).
  * (44) J. Rodríguez-Carvajal, Phys. B 192, 55 (1993).
  * (45) N. N. Greenwood and A. Earnshaw, $ChemistryoftheElements$ (Elsevier Ltd, Oxford, 1997).
  * (46) A. P. Ramirez, $HandbookofMagneticMaterials$, Vol. 13, edited by K. Buschow (Elsevier, Amsterdam, 2001), p. 423.
  * (47) A. P. Ramirez, Annu. Rev. Mater. Sci. 24, 453 (1994).
  * (48) H. T. Diep, $FrustratedSpinSystems$ (World Scientific, Singapore, 2004).
  * (49) M. P. Shores, E. A. Nytko, B. M. Bartlett, and D. G. Nocera, J. Am. Chem. Soc. 127, 13462 (2005).
  * (50) H.-F. Li, C. Zhang, A. Senyshyn, A. Wildes, K. Schmalzl, W. Schmidt, M. Boehm, E. Ressouche, B. Hou, P. Meuffels, G. Roth, and Th. Br$\ddot{\rm u}$ckel, Front. Phys. 2, 42 (2014).
  * (51) H.-F. Li, A. Senyshyn, O. Fabelo, J. Persson, B. Hou, M. Boehm, K. Schmalzl, W. Schmidt, J.-P. Vassalli, P. Thakuria, X. Sun, L. Wang, G. Khazaradze, B. Schmitz, C. Zhang, G. Roth, J. G. Roca, and A. Wildes, J. Mater. Chem. C 3, 7658 (2015).
  * (52) H.-F. Li, npj Comput. Mater. 2, 16032 (2016).
  * (53) A. H. Cooke, D. M. Martin, and M. R. Wells, J. Phys. C: Solid State Phys. 7, 3133 (1974).
  * (54) W. L. Stephen, $Theoryofneurtronscatteringfromcondensedmatter$ (Clarendon Press, Oxford, 1984).
  * (55) C. Kittel, $QuantumTheoryofSolids$ (Wiley, New York, 1987).
  * (56) H. F. Li, Y. Su, J. Persson, P. Meuffels, J. M. Walter, R. Skowronek, and Th. Br$\ddot{\rm u}$ckel, J. Phys.: Condens. Matter 19, 016003 (2006).
  * (57) H. F. Li, Y. Su, J. Persson, P. Meuffels, J. M. Walter, R. Skowronek, and Th. Br$\ddot{\rm u}$ckel, J. Phys.: Condens. Matter 19, 176226 (2007).
  * (58) A. Tari, $TheSpecificHeatofMatteratLowTemperatures$ (Imperial College Press, London, 2003).
  * (59) H.-F. Li, A. Wildes, B. Y. Hou, C. Zhang, B. Schmitz, P. Meuffels, G. Rothb, and Th. Br$\ddot{\rm u}$ckel, RSC Adv. 4, 53602 (2014).
  * (60) M. F. Collins, $MagneticCriticalScattering$ (Oxford University Press, London, 1989).
  * (61) S. J. Payne, M. E. Hagen, and M. J. Harris, J. Phys.: Condens. Matter 8 91 (1996).
  * (62) H.-F. Li, Y. Xiao, B. Schmitz, J. Persson, W. Schmidt, P. Meuffels, G. Roth, and Th. Br$\ddot{\rm u}$ckel, Sci. Rep. 2, 750 (2012).
  * (63) D. C. Wallace, Phys. Rev. B 58, 15433 (1998).
  * (64) L. Vo$\breve{\textrm{c}}$adlo, K. S. Knight, G. D. Price, and I. G. Wood, Phys. Chem. Miner. 29, 132 (2002).
  * (65) H.-F. Li, J. Q. Yan, J. W. Kim, R. W. McCallum, T. A. Lograsso, and D. Vaknin, Phys. Rev. B 84, 220501(R) (2011).
  * (66) A. Kotani, H. Nakajima, K. Harada, Y. Ishii, and S. Mori, Phys. Rev. B 95, 144403 (2017).


11institutetext: Princeton University, Princeton, New Jersey, United States.
22institutetext: Institute of Engineering and Management, Kolkata, West
Bengal, India.

# AwkwardForth: accelerating Uproot with an internal DSL

Jim Pivarski 11<EMAIL_ADDRESS>Ianna Osborne 11<EMAIL_ADDRESS>Pratyush Das 22<EMAIL_ADDRESS>David Lange 11<EMAIL_ADDRESS>Peter
Elmer 11<EMAIL_ADDRESS>
###### Abstract

File formats for generic data structures, such as ROOT, Avro, and Parquet,
pose a problem for deserialization: it must be fast, but its code depends on
the type of the data structure, not known at compile-time. Just-in-time
compilation can satisfy both constraints, but we propose a more portable
solution: specialized virtual machines. AwkwardForth is a Forth-driven virtual
machine for deserializing data into Awkward Arrays. As a language, it is not
intended for humans to write, but it loosens the coupling between Uproot and
Awkward Array. AwkwardForth programs for deserializing record-oriented formats
(ROOT and Avro) are about as fast as C++ ROOT and 10–80$\times$ faster than
fastavro. Columnar formats (simple TTrees, RNTuple, and Parquet) only require
specialization to interpret metadata and are therefore faster with precompiled
code.

##  1 Motivation

Despite being written in Python, Uproot uproot  can read simple data types
from ROOT TTrees root  as fast as any precompiled code because the values are
already contiguous in a raw view of the file. No computations are required to
get a ROOT TBasket of numerical data from disk into memory, as an array,
except to swap endianness if little-endian arrays are desired. Python’s NumPy
numpy  library casts data from raw bytes as a metadata-only operation, and
performs operations that scale as $\mathcal{O}(n)$, where $n$ is the length of
the array, in precompiled code.

For more complex data types, however, the cost of computing in Python
increases. Variable-length (“jagged”) arrays are relatively quick, since
ROOT’s TTree format separates the numerical content of these arrays from the
integers that define the starting positions of each entry’s array. This is
nearly the format required by Awkward Array awkward , and only needs minor
arithmetic transformations. Objects with fixed-size headers and consisting of
fixed-size fields, such as std::vector<TLorentzVector>, can be extracted using
NumPy tricks, though these tricks require more intermediate arrays, further
slowing the transformation. Finally, general objects with nested, variable-
length data, the simplest of which is std::vector<std::vector<float>>, require
custom code to parse each data type. In Python, such code is hundreds of times
slower than the equivalent C++.

Previously, we quantified this slow-down chep2019  using ROOT TTrees
containing float, std::vector<float>, and vectors of vectors up to three
levels deep, reading them with the then-current Python codebase and with
custom C++ code, which represents what is possible now that Awkward Array is
implemented in C++. The read performance of float data is identical for Python
and C++, the C++ is several times faster for std::vector<float>, and the gap
widens to factors of hundreds for the doubly-nested and triply-nested cases.
Leveraging Awkward Array’s C++ layer to accelerate Uproot is a worthwhile
goal.

However, unless we limit our attention to special cases like nested vectors of
numbers, this deserialization code is not known at compile-time. The byte-for-
byte layout of a complex data type is expressed as data, in the TStreamerInfo
of a ROOT file, and is therefore discovered at runtime. Moreover, the
specifics of ROOT deserialization should not be spread between two packages,
Uproot and Awkward Array: Uproot should focus entirely on ROOT I/O as Awkward
Array focuses on array manipulation. The problem is to satisfy three
constraints:

  1. 1.

Deserialization code must not be hundreds of times slower than compiled code.

  2. 2.

This code must be generated at runtime from TStreamerInfo.

  3. 3.

All “knowledge” of ROOT I/O must be in Uproot, not Awkward Array.

The first two constraints could be satisfied by just-in-time (JIT)
compilation. This is, in fact, what ROOT’s Cling compiler cling  does. The
third constraint could be satisfied by adding a C++ layer to Uproot. Both of
these solutions, however, would significantly complicate the distribution of
the Uproot or Awkward Array packages, and portability is a high priority.

This paper describes a different solution to the constraints listed above,
which does not affect the portability of Uproot or Awkward Array. We introduce
AwkwardForth, a domain-specific language (DSL) for deserializing arbitrary
data into Awkward Arrays that is runtime-interpreted but nearly as fast as
compiled code. Unlike DSLs intended for humans to read and write, this DSL is
“internal,” only used to communicate between software packages. Uproot’s task
becomes one of expressing ROOT I/O logic in AwkwardForth and Awkward Array
executes it, returning filled arrays.

##  2 AwkwardForth

AwkwardForth is a member of the Forth family of languages, which includes
Postscript postscript , another internal DSL. AwkwardForth adheres to a subset
of the ANSI Forth Standard forth-standard  and has extensions for interpreting
arbitrary input buffers and filling columns for Awkward Array.

Like all Forths, AwkwardForth is primarily concerned with stack manipulation.
The runtime environment features a stack of integers and programs define
“words” that manipulate the stack (as well as input and output buffers, in the
case of AwkwardForth). Each word consumes and produces an arbitrary number of
arguments and return values through this stack, and hence Forth words are more
general than functions in a typical programming language. Whereas functional
programming languages eliminate or minimize side-effects, Forth acts
exclusively through side-effects. As such, it is more like an extensible
assembly language.

The popularity of Forth peaked in the early 1980’s because its interactive
interpreter could fit within the tight resource constraints of early personal
computers forth . This same interactive minimalism makes it an ideal candidate
for running fast programs that must be generated at runtime, such as
deserializing ROOT files. On typical hardware, AwkwardForth takes about 5 ns
to evaluate each word, compared to about 900 ns for Python to evaluate a
bytecode.

Though motivated by the problem of ROOT deserialization, AwkwardForth is
intended for the general problem of deserializing non-columnar data formats
into columnar Awkward Arrays. Many file formats, such as ProtoBuf protobuf ,
Thrift thrift , Avro avro , FlatBuffers flatbuffers , and JSON json , describe
data structures in a record-oriented layout, with all fields of one record
contiguous with each other, while columnar formats like simple TTrees, RNTuple
rntuple , Parquet parquet , Arrow arrow , and Awkward Array place all values
of one field contiguous with each other before moving on to the next field.
Conversions between columnar formats can be very fast, sometimes casting,
rather than copying, the columns. Record-oriented formats, on the other hand,
must be fully parsed. In this paper, we examine AwkwardForth’s deserialization
performance for ROOT TTrees (columnar and record-oriented), Avro, and Parquet.

Awkward Array has a tool for converting arbitrary record-oriented data into
Awkward Arrays: ArrayBuilder constructs arrays in an append-only order, driven
by commands such as begin/end_record, switch to field, append integer, and
begin/end_list. A consequence of this generality is that ArrayBuilder
discovers the array’s data type at runtime, adding output buffers as the
observed type gets more complex. While this is great for JSON, type discovery
is unnecessarily slow for formats whose type is known in advance, though
perhaps not as early as compile-time. (Uproot currently uses ArrayBuilder in
Python.) In this paper, we also consider the design of a TypedArrayBuilder,
which generates AwkwardForth programs from data types, but is still driven by
ArrayBuilder-like commands.

##  3 AwkwardForth virtual machine

AwkwardForth is implemented in C++ as a virtual machine with byte-compiled
instructions. It is not interactive, unlike most Forths, since it is intended
to be programmed algorithmically. Even the TypedArrayBuilder use-case would
operate by “wiring” its fixed suite of commands to algorithmically generated
words. Some TypedArrayBuilder commands must change the state of its finite-
state machine: for instance, when filling an array of doubly nested lists of
integers, the first begin_list puts it into a state that expects another
begin_list or end_list; the second puts it into a state that expects integer
or end_list. And yet, each of these commands must return control-flow to its
caller and remember its state for the next call. To implement
TypedArrayBuilder with an AwkwardForth machine, the AwkwardForth machine must
be able to stop and resume with its state intact (unlike most Forths).
AwkwardForth, therefore, has built-in words to control its own execution
(pause and halt), and the execution may be resumed from outside the machine.

When an AwkwardForth machine is first constructed, it compiles its source code
(text) into bytecode instructions (variable-length sequences of 32-bit
integers—a jagged array), so that so that they can be interpreted more
quickly. This is the same sense in which Python code is “compiled.” Built-in
words translate to 1–3 integer codes, the second and third being arguments
that modify the first. User-defined words are separate sequences of
instructions, called a “dictionary” in Forth. Control-flow structures, such as
if and loop, are implemented as unnamed user-defined words so that their
bodies are fixed-width “calls” into the dictionary, simplifying the logic of
instruction pointer manipulation.

All errors are caught in the compilation phase except for 10 possible runtime
errors: “user halt,” “recursion depth exceeded,” “stack underflow,” “stack
overflow,” “division by zero,” “read beyond,” “seek beyond,” “skip beyond,”
“rewind beyond,” and “varint too big.” The last 5 of these are specific to
parsing input buffers.

All runtime execution is implemented in a single “noexcept” C++ function for
speed.

An arbitrary number of named input buffers and named output buffers are
associated with each AwkwardForth program. Inputs must be supplied at the
beginning of a run; outputs are also created at this time. Input buffers,
which are the data to be parsed, are viewed as untyped raw bytes, interpreted
by the words of the program itself. Output buffers, which are columns to use
in a new Awkward Array, have specific numerical types and can only be filled
with that type. Inputs have a fixed size and are seekable; outputs grow in an
append-only way.

##  4 AwkwardForth language

Like all Forth languages, AwkwardForth has an extremely simple syntax:
whitespace delimits tokens and tokens are interpreted in reverse Polish order:
“3 4 +” means the sum of 3 and 4 (the first two words put numbers on the stack
and the third pops them and pushes their sum).

AwkwardForth has 57 standard built-in words and 61 extensions for input and
output buffers, though 50 of the 61 are different ways of interpreting the
bytes of an input buffer. Two special words control the state of the virtual
machine: pause and halt, and three do not generate runtime code at all: they
declare variables, inputs, and outputs.

variable variable_name ( Standard Forth ) input  input_name ( AwkwardForth
extension ) output  output_name output_type ( AwkwardForth extension )

As in Standard Forth, user-defined words are bracketed between : and ; and the
main code is anything outside these definitions. Control structures are pairs
of words like if-then and do-loop, or triples like if-else-then and begin-
while-repeat.

: fibonacci ( pops n -- pushes nth-fibonacci-number ) dup 1 > if 1- dup 1-
fibonacci swap fibonacci + then ; ( pushes [0 1 1 2 3 5 8 13 21 34 55 89 144
233 377] onto the stack ) 15 0 do i fibonacci loop

The 50 special words for parsing are all arrows with a type code, an optional
! for big-endian and an optional # to pull a number off the stack to determine
how many times to repeat it. Thus, “input_name i-> output_name” reads 4 bytes
from the input as an integer and writes it to the output, “input_name !d->
output_name” reads 8 bytes as a big-endian, double-precision float, and “100
input_name #I-> output_name” reads 100 unsigned 4-byte integers. In any case,
the destination may be the stack: “input_name i-> stack”.

The type codes are taken from Python’s struct module, which AwkwardForth most
closely resembles in purpose (but vastly exceeds in expressiveness). Two
special codes, varint-> and zigzag->, read variable-length unsigned integers
and zig-zag encoded signed integers, which are used in many file formats,
including Avro and Parquet. Also, Parquet needs a command to read $n$-bit
unsigned integers, hence 2bit->, 3bit->, etc. for any $n$.

Outputs are similar, but less varied because they have preassigned types. They
may be filled directly from an input (bypassing the stack for efficiency and
to preserve the types of floating point numbers) or filled from the stack:
“output_name <- stack”. A shortcut for appending the last output plus a value
from the stack is “output_name +<- stack”.

More built-in words can be added to handle problems posed by input formats.
Since each built-in word has a fixed 5 ns cost, specialized words result in
faster AwkwardForth code.

##  5 AwkwardForth programs for ROOT, Avro, and Parquet

To read a TBasket of std::vector<std::vector<float>> from ROOT, we use the
following AwkwardForth program:

input data ( ROOT TBaskets have a data buffer ) input byte_offsets ( and a
buffer of byte offsets ) output offsets0 int32 ( output Awkward Array offsets
) output offsets1 int32 ( ... ) output offsets2 int32 ( ... ) output content
float32 ( and content ) 0 offsets0 <- stack ( offsets start at zero ) 0
offsets1 <- stack 0 offsets2 <- stack begin byte_offsets i-> stack ( get a
position from the byte offsets ) 6 + data seek ( seek to it plus a 6-byte
header ) data !i-> stack ( get the std::vector size ) dup offsets0 +<- stack (
add it to the offsets ) 0 do ( and use it as the loop counter ) data !i->
stack ( same for the inner std::vector ) dup offsets1 +<- stack 0 do data !i->
stack ( and the innermost std::vector ) dup offsets2 +<- stack data #!f->
content ( finally, the floating point values ) loop loop again ( ends with a
"seek beyond" exception )

To read data with the same structure from Avro, we use the program below. It
is applied to each data block of an Avro container file, with the AwkwardForth
machine stack initialized with the number of entries in the block.

input data ( an Avro data block is a single buffer ) output offsets0 int32 (
output Awkward Array offsets ) output offsets1 int32 ( ... ) output offsets2
int32 ( ... ) output content float32 ( and content ) 0 offsets0 <- stack (
offsets start at zero ) 0 offsets1 <- stack 0 offsets2 <- stack 0 do ( upper
limit on the stack at startup ) data zigzag-> stack dup offsets0 +<- stack (
add it to the offsets ) 0 do ( and use it as the loop counter ) data zigzag->
stack dup offsets1 +<- stack 0 do data zigzag-> stack dup offsets2 +<- stack
data #f-> content ( finally, the floating point values ) data b-> stack drop (
ends with a zero-byte ) loop data b-> stack drop ( lists also end with a zero-
byte ) loop data b-> stack drop ( lists also end with a zero-byte ) loop

Parquet is a columnar file format, so the floating-point content comes in a
form that’s ready to use in Awkward Array, without even copying the
uncompressed buffer. However, the nested list structure is in a highly packed
form: repetition levels indicating the depth of each floating-point item,
which are further run-length encoded or bit-packed in small groups.

We unpack them using two AwkwardForth programs: the first produces the
repetition levels as unsigned 1-byte integers and the second converts them
into three levels of offsets.

input data output replevels uint8 ( output 1-byte integers ) data I-> stack (
get the number of bytes to read ) begin data varint-> stack ( read a variable-
length integer ) dup 1 and ( its lowest bit selects encoding type ) 0= if (
zero means run-length encoding... ) data B-> replevels ( write the value to
duplicate ) 1 rshift 1- ( determine how many times ) replevels dup ( duplicate
it ) else ( non-zero means bit-packed... ) 1 rshift 8 * ( determine how many
to read ) data #2bit-> replevels ( read all the 2-bit integers ) then dup data
pos 4 - ( continue until end of input buffer ) until

This last program interprets the repetition levels as offsets. It uses
variables to count the number of items at each level of list depth since all
three need to be increased concurrently and using swap or rot to manage them
on the stack would be unnecessarily complex. The Standard Forth words @, !,
and +! read, write, and increment an off-stack variable. Variables have the
same integer type as the stack and are initially zero.

input replevels output offsets0 int32 output offsets1 int32 output offsets2
int32 variable count0 variable count1 variable count2 begin replevels b->
stack ( get one repetition level ) dup 3 = if ( 3 means deepest level of
structure ) 1 count2 +! then dup 2 = if ( 2 means a new innermost list ) 1
count1 +! count2 @ offsets2 +<- stack 1 count2 ! then dup 1 = if ( 1 means a
new inner list ) 1 count0 +! count1 @ offsets1 +<- stack 1 count1 ! count2 @
offsets2 +<- stack 1 count2 ! then 0 = if ( 0 means a new outer list ) count0
@ offsets0 +<- stack 1 count0 ! count1 @ offsets1 +<- stack 1 count1 ! count2
@ offsets2 +<- stack 1 count2 ! then replevels end ( continue to the end of
input ) until count0 @ offsets0 +<- stack ( add the last counts for all three
) count1 @ offsets1 +<- stack count2 @ offsets2 +<- stack

Programs such as these would not be written (and commented!) by hand, but
generated by Uproot, other file-readers that produce Awkward Arrays, or
TypedArrayBuilder.

##  6 Example of an AwkwardForth program for TypedArrayBuilder

The TypedArrayBuilder is still in development, but the following illustrates
AwkwardForth that can be generated for a triply nested list of float.

input data ( a single value: argument to append ) output offsets0 int32 (
output Awkward Array offsets ) output offsets1 int32 ( ... ) output offsets2
int32 ( ... ) output content float32 ( and content ) 0 offsets0 <- stack (
offsets start at zero ) 0 offsets1 <- stack 0 offsets2 <- stack : node3
{float32-command} = if 0 data seek ( calling code puts the next value at )
data d-> content ( the beginning of the input buffer ) else halt ( only the
"float32" command is allowed ) then ; {node2} {node1} {node0} ( see below ) 0
begin pause node0 ( pause for input, run forever ) again

The words in curly brackets are strings to be replaced, such as the following
for {nodeN}:

: {node_name} {begin_list-command} <> if ( "begin_list" is required here )
halt then 0 begin pause dup {end_list-command} = if drop {offsets_name} +<-
stack ( update offsets for this array node ) exit ( exit this subroutine’s
infinite loop ) else {next_node_name} ( another list node like this or node3 )
1+ then again ;

The {*-command} substitutions are integers associated with each command. The
virtual machine waits at a pause word until TypedArrayBuilder puts a command
number on the stack (and a number value in the input buffer for the float32
command), then resumes program flow, letting AwkwardForth format the output or
halt if the wrong command is called. Thus, TypedArrayBuilder can be statically
compiled but “wired” to different actions at runtime.

##  7 Performance

Figure 1 presents single-threaded deserialization rates of uncompressed ROOT,
Avro, and Parquet files from a warmed filesystem cache on an Intel i7-8750H
(2.2 GHz) processor. There are four test files for each format: 4-byte float,
variable-length lists of float, doubly nested lists of lists of float, and
triply nested lists of lists of lists of float. For ROOT files, variable-
length lists are std::vector, but in Avro they are called “arrays” (despite
being variable-length), and in Parquet, they are called “repeated groups.” All
four types of files contain exactly 1 073 741 824 float values and are all
approximately 4 GiB (large, but well within the 15.5 GiB of physical RAM). The
lengths of the lists at each level of depth are Poisson-distributed with a
mean of 8.0 items per list. ROOT’s TBasket size, Avro’s data block size, and
Parquet’s row-group and page sizes were all fixed at 64 MiB.

Figure 1: Deserialization rate for converting uncompressed ROOT, Avro, and
Parquet files to Awkward Arrays from warm cache. C++ ROOT, fastavro, and
pyarrow are the leading libraries for each file type.

The ROOT files were read in three ways: (1) using C++ ROOT, loading data with
TBranch::GetEntry) and copying it into offsets0, offsets1, offsets2, and
content buffers for Awkward Array, (2) using Uproot 4.0.1’s Python code, and
(3) using AwkwardForth (with Uproot to find the TBaskets within the file).

As an additional comparison, the same data were converted into ROOT’s future
RNTuple format, which is truly columnar. As expected (reproducing our previous
results chep2019 ), float data are fastest to read, being essentially a
memory-copy from TBaskets or RNTuple pages into the content buffer. (ROOT’s
TBranch::GetEntry is not as fast as direct memory access, which could be
enabled by switching to ROOT’s BulkIO feature, but we did not attempt that in
this study.) RNTuple maintains this speed for all levels of nestedness for the
same reason, while Uproot’s NumPy tricks slow down reading of
std::vector<float> and Uproot’s pure Python is orders of magnitude slower for
any deeper nesting. However, AwkwardForth keeps pace with ROOT’s
TBranch::GetEntry at all levels of nestedness.

We next compared AwkwardForth with fastavro, the leading Python package for
reading Avro files. fastavro is a Python extension library, using the C Avro
implementation for speed. However, fastavro is compiled without knowledge of
the schemas of the Avro files, which limits this advantage. AwkwardForth, on
the other hand, has specialized Forth code for each data type and it’s fast
enough to read Avro 10–80$\times$ faster than fastavro.

Finally, we compared AwkwardForth with pyarrow, a Python extension library for
the C++ Arrow and Parquet projects. In this case, pyarrow outperforms
AwkwardForth by factors of 1.5–8$\times$. The AwkwardForth programs for
Parquet in Section 5 show why: there’s nothing about them that specializes to
the data type except for the #2bit-> repetition level reader (deeper levels of
nesting require logarithmically more bits) and the number of count variables
and offset buffers. Any data type can be efficiently read with the same C++
code.

For compressed data (not shown in Figure 1), all rates are suppressed by a
constant for each algorithm. LZ4 is about 10% slower than the memory copy, but
ZLIB is 10$\times$ slower than the memory copy, so AwkwardForth is not the
bottleneck for ZLIB-compressed data.

We also studied the scaling of AwkwardForth with threads. The AwkwardForth
virtual machine is stateful, but lightweight: many can be launched at once,
one for each thread. Figure 2 shows deserialization rate of the ROOT files on
an AWS c5.18xlarge instance, which has 72 cores. Linear scaling falls off at
about 20 threads, or 4–5 GiB per second, which may be a limitation of memory
bus supplying data from RAM. Python, by comparison, does not scale at all
because of its Global Interpreter Lock (GIL) python-gil .

Figure 2: Scaling of deserialization by the number of threads. AwkwardForth
(when called from Python) releases the Python GIL, which otherwise prevents
any gains from parallel processing.

All scripts used to produce Figures 1 and 2 are available on GitHub this-study
.

##  8 Conclusions

AwkwardForth is a “lightweight” solution to the problem of generating fast
deserialization code whose form is only known at runtime. In all, it consists
of 3388 lines of C++ code in Awkward Array (version 1.1.0), with no
dependencies. Unlike user-facing DSLs, its syntax is not subject to usability
constraints, only ease of algorithmic generation and speed. As shown in
Section 7, it keeps pace with ROOT’s own TTree deserialization, exceeds
fastavro for Avro, and is slower than but within an order of magnitude of
pyarrow for Parquet.

Most importantly, AwkwardForth vastly improves upon the Python code in Uproot,
speeding up std::vector<std::vector<float>> deserialization by factors of
hundreds, and it makes parallel TBasket reading worthwhile. It will be
integrated into Uproot this year (2021).

##  9 Acknowledgements

This work was supported by the National Science Foundation under Cooperative
Agreement OAC-1836650 (IRIS-HEP).

## References

  * (1) J. Pivarski et al., _Uproot_ , https://doi.org/10.5281/zenodo.4543730
  * (2) R. Brun, F. Rademakers, _ROOT: An object oriented data analysis framework_ , Nucl. Instrum. Meth. A 389, 81 (1997)
  * (3) C.R. Harris, K.J. Millman, S.J. van der Walt, R. Gommers, P. Virtanen, D. Cournapeau, E. Wieser, J. Taylor, S. Berg, N.J. Smith et al., _Array programming with NumPy_ , Nature 585, 357 (2020)
  * (4) J. Pivarski et al., _Awkward Array_ , https://doi.org/10.5281/zenodo.4539721
  * (5) J. Pivarski, P. Elmer, D. Lange, _Awkward Arrays in Python, C++, and Numba_ , in _European Physical Journal Web of Conferences_ (2020), Vol. 245 of _European Physical Journal Web of Conferences_ , p. 05023, 2001.06307
  * (6) V. Vasilev, P. Canal, A. Naumann, P. Russo, _Cling – The New Interactive Interpreter for ROOT 6_ , Journal of Physics: Conference Series 396, 052071 (2012)
  * (7) G. Reid, _Thinking in PostScript_ (Addison-Wesley, 1990), ISBN 9780201523720, https://books.google.com/books?id=ZeRXvgAACAAJ
  * (8) Technical Committee X3J14, _ANSI Forth Standard_ (1994), https://www.taygeta.com/forth/dpans.html
  * (9) E.D. Rather, D.R. Colburn, C.H. Moore, _The Evolution of Forth_ , in _The Second ACM SIGPLAN Conference on History of Programming Languages_ (Association for Computing Machinery, New York, NY, USA, 1993), HOPL-II, p. 177â199, ISBN 0897915704, https://doi.org/10.1145/154766.155369
  * (10) _Google ProtoBuf_ , https://developers.google.com/protocol-buffers/
  * (11) _Apache Thrift_ , https://thrift.apache.org/
  * (12) _Apache Avro_ , http://avro.apache.org/
  * (13) _Google FlatBuffers_ , https://google.github.io/flatbuffers/
  * (14) _JSON_ , https://www.json.org/
  * (15) J. Blomer, P. Canal, A. Naumann, D. Piparo, _Evolution of the ROOT Tree I/O_ , in _European Physical Journal Web of Conferences_ (2020), Vol. 245 of _European Physical Journal Web of Conferences_ , p. 02030, 2003.07669
  * (16) _Apache Parquet_ , https://parquet.apache.org/
  * (17) _Apache Arrow_ , https://arrow.apache.org/
  * (18) D. Beazley, _Understanding the Python GIL_ , in _PyCON Python Conference. Atlanta, Georgia_ (2010)
  * (19) _Performance measurement code for this study_ , https://github.com/scikit-hep/awkward-1.0/tree/1.1.0/studies/awkward-forth-performance