1 Introduction

Dilute magnetic semiconductors (DMS) and half-metals (HM) are essential for the development of high-speed switching and small memory systems. Although spin and charge give DMS materials their magnetic and semiconducting capabilities, HM exhibits metallic behavior in one spin channel and semiconducting/insulating behavior in the other [1]. This means that one spin state is preferable for electrical conduction while the other spin state acts as a switch by preventing conduction. Half-metal device applications have been described for a number of the DMS as mentioned above materials, including La1–xCaxMnO3, CrO2, NiMnSb, PtMnSb, Co2FeSi, NiCrSi, and PdCrSi [2,3,4,5].

Layered metal dichalcogenides (LMD) have significant attention due to their structural, electrical, magnetic, and optical properties, and they are well suited for optoelectronic and electronic devices as field effect transistors (FET) [6, 7]. Layered metal dichalcogenides (MX2), which consist of a metal atom M sandwiched between two layers of chalcogen atom X (such as S and O), have gained significant attention as a fascinating class of 2D, and it shows the covalent bond within the layer and van der Waals forces between the layers. SnS2 is a two-dimensional layered metal dichalcogenide material with a direct band gap of (~ 2.1 eV) having hexagonal structure (P-3m1) with lattice parameter a = b = 3.6486 Å and c = 5.899 Å. It is an attractive semiconductor material used to fabricate dilute magnetic semiconductors (DMS) at room temperature, which gives rise to potential applications in electronics, optics, spintronics, and valleytronics [8, 9].

Introducing impurity levels by doping transition metals may alter magnetic characteristics and charge transfer transitions. Atomic number, valence state, and orbital hybridization determine the unique actions of 3d, 4d, and 5d transition metals on SnS2 [8, 10, 11]. Layered metal dichalcogenides (LMDs) doped with transition metals (i.e., Fe, Mn, Co, Mn, and Ni) exhibit ferromagnetic behavior at room temperature and also transition metals commonly used as dopants to modify the absorption spectrum of semiconductor material, which can lead to improved photocatalytic performance [12]. High optoelectronic performance is shown in the Fe-doped SnS2 monolayer, which also displays ferromagnetism with a Curie temperature of about 31 K [13]. Doping vanadium (V) into SnS2 holds significant promise for enhancing its performance in photovoltaic applications [14]. Incorporating copper (Cu) dopants into SnS2 shows excellent potential for improving its suitability in photodetection and sensor applications [15]. Ni doping leads to the enhancement of the light of SnS2 in the visible light regions [16]. Lower concentrations of Ni have a greater saturation magnetization [17]. Nickel doped with SnS2 is widely valued due to the mentioned advantages.

Ni-doped SnS2 has seen little research so far. Hang Chu et al. wrote a paper [18] about a symmetric supercapacitor that worked better in Ni-doped SnS2-GA (graphene aerogel) than in SnS2-GA (171.56 F/g). The scan rate was 5 mV/s. Mn-doped SnS2-GA has been reported to have improved supercapacitance performance. Batjargal Sainbileg et al. did the first principle study on Ni-doped SnS2 and found that the band gap could get smaller and the indirect band gaps could become direct band gaps [19]. Composite Ni-doped Fe3O4 and SnS2 have been reported by [20] to have increased photo-Fenton activity and rhodamine B photodegradation compared to the individual Ni-doped Fe3O4 and SnS2. Zhang et al. [21] report on 93% CO2 electro-reduction in 5% Ni-doped SnS2 nanosheets. Ni-doped SnS2-SnO2 calcinated at 100 ºC is effective in photodegrading methyl orange under simulated sunlight, as reported by Dayong Chen et al. [22].

Based on the above literature, it is clear that mixing Ni-doped SnS2 with some other compounds makes it work better in many different situations, like supercapacitors, photodegradation, and more. Doping different elements in different concentrations leads to fine-tuning the physical, chemical, and physiochemical behavior of the host material of particular interest. Nickel is one of the potential elements that can be easily doped in SnS2 due to its similar ionic radius to Ni2+/Ni3+ and Sn4+. Further, it is cost-effective, abundant in nature, moderately toxic, and possesses good chemical stability [23]. The optical band gap and magnetic saturation can be tuned easily by adding a dilute amount of Ni doping.

Further in this work, the doping concentration of Ni dopant is varied from 2.5 to 7.5% to optimize the magnetic properties of Ni-doped SnS2. However, to our knowledge, research has yet to be published on the electronic structure and optical, electrical, and magnetic characteristics with a view to applications using magnetic semiconductors. In the first part of this study, the exact electronic structure is looked at using the Rietveld refinement (profile fitting method), along with the specific type and strength of bonding behavior of the component ions in Ni-doped SnS2 using MEM. Additionally, pair distribution function (PDF) analysis of XRD data determines the local structure. The second phase uses suitable experimental techniques to analyze the optical and magnetic properties. The correlation between the electronic structure and the optical, electrical, and magnetic characteristics is the main objective of the reported work.

2 Sample preparation and data analysis

Tin tetrachloride pentahydrate [SnCl4.5H2O], nickel (II) chloride hexahydrate [NiCl2. 6H2O], with purity of 98% and 99.9%, purchased from Sigma Aldrich, India, and 99% pure thiourea [CS(NH2)2], purchased from Nice Chemicals, India, were used in a hydrothermal synthesis to produce NixSn1–xS2: x = 0.025, 0.05, 0.075. The initial ingredients were diluted to the proper concentrations and then placed in a Teflon-lined autoclave for 20 h of heating at 180ºC. The resulting powder was washed many times with distilled water and dried at 90ºC for 12 h [24]. The dry substances were finely milled and sieved through a 400-micron nylon mesh for X-ray powder diffraction investigations. The powder XRD data were taken at room temperature using a Bruker Eco DS Advance instrument with a slow  scan from 10° to 120° with a step size of 0.02°. The radiation was copper  at a wavelength of (λ = 1.5406 Å). The structural information was computed from powder XRD data using the Rietveld refinement method implemented in JANA 2006 [25, 26]. Average structural analysis like electron density distribution, bonding nature, and local structural analysis, such as nearest neighbor distance and bond length, was done by maximum entropy method (MEM) and pair distribution function (PDF) [27, 28]. The Jeol 6390LA SEM/EDAX instrument at 20 kV was used to study the samples surface morphology and elemental composition. At the same time, the SHIMAZDU/UV 2600 and the Perkin Elmer LS45 were utilized to analyze optical features, such as UV–visible absorption and photoluminescence, respectively. The magnetism at room temperature was analyzed using Lakeshore 7410S VSM equipment.

3 Results and discussion

3.1 Preliminary XRD analysis

Room temperature powder XRD intensity data was collected with  ranging from 10º to 100º in steps of 0.02º for NixSn1–xS2: x = 0.025, 0.05, 0.075. The observed XRD peaks well matched with (JCPDS: 23-0677), the standard pristine SnS2 hexagonal structure (space group P-3m1) with prominent peaks corresponding to the Bragg planes (001), (100), (101), (102), (003), (110), (111) without any impurity peaks as shown in Fig. 1. Ni doping in SnS2 creates a slight variation in XRD intensity, possibly due to the structure factor and, hence, electron density variation. Lattice distortion can change the electronic band structure, creating localized electronic states within the bandgap. These states can facilitate charge carrier transport and improve the materials electrical conductivity, making it more suitable for electronic and optoelectronic applications. Further, the dilute (small) doping concentration of dopant atoms (Ni) into a semiconductor host material (Sn) may cause local distortions in the lattice/interstitial, which affect the average and local structural parameters, such as the lattice constant, crystallite size, microstructural strain isotropic/anisotropic distortions, nearest neighbor distance, and bond length and strength. These distortions are intrinsic and will not alter the crystal structure or crystalline phase.

Fig. 1
figure 1

Experimental X-ray intensity profile of NixSn1–xS2: x = 0.025, 0.05, 0.075 corresponds well with the hexagonal structure of pure SnS2 devoid of impurity phases. As depicted by inset diagrams, an expanded form of the (101) plane reveals information about peak shift and crystallite size

Good crystallization with estimated crystallite size ranging from 24.64 nm to 32.56 nm, obtained by the Debye Scherrer method, considering the (101) prominent Bragg peak, is given in the inset diagrams of Fig. 1. This result is in good agreement with the Halder- Wagner plot, which is a plot of (β*/d*)2 Vs (β*/d*2), with (β* = β(cos θ)/λ) and (d* = (2dsinθ)/λ), where β is the full width at half maximum and d the distance between the lattice planes [29]. The crystallite size and lattice strain estimate are shown in the supplementary figure (Fig. S1). The peak position of the (101) Bragg peak has Bragg angles 32.17º, 32.29º, and 32.177º, respectively, for NixSn1–xS2: x = 0.025, 0.05, 0.075 compositions. No shift in  toward a higher angle is observed for 2.5% and 7.5% compositions. However, a noticeable shift in  in 5% Ni composition may be due to the interstitial charge accumulation of Ni2+ ions and the substitutional Ni3+ ions at regular lattice sites. The above argument is validated through the ESR results and MEM charge density analysis discussed in Sects. 3.8 and 3.3, respectively.

3.2 Rietveld analysis

The electronic structure, i.e., electron density distribution and type and strength of bonding, ultimately depends on the X-ray structure factor from various lattice planes. The structure factor can be calculated from the experimental powder XRD data using the Rietveld technique, a powder XRD profile fitting methodology. Equation (1) shows structure factor for X-ray diffraction planes (h k l)

$$ F_{hkl} = \sum N_{j } f_{j} \exp \left( {2\pi i\left( {hx_{j} + ky_{j} + kz_{j} } \right)} \right). $$
(1)

Here xj, yj, zj are the fractional coordinates of jth atom. Nj and fj are the number of equivalent positions and atomic scattering factor of the jth atom respectively. JANA2006 software fits the observed XRD intensity profile with the crystallographic model-based calculated fit with minimum acceptable error. The slight difference between the observed and calculated structure factor will confirm the reliability and accuracy of the refinement process. Refinable crystallographic parameters include unit cell parameters, atomic coordinates, atomic displacement parameters, atomic site occupancies, and profile and modulation parameters. JANA2006 can fix or refine individual parameters as and when needed. Rietveld refinement is a widely used method to determine the crystal structure with the help of JANA 2006 software. The profile refinement procedure has proved superior to other methods involving either peak separation or the total integrated intensity of groups of overlapping peaks. Rietveld refinement method determines the crystal structure of a material from its powder diffraction with the help of structural coefficients, such as lattice constants, unit cell parameters, atomic positions, thermal vibrations (Debye–Waller factors), and isotropic/anisotropic displacement parameters. The accurate profile following the observed profile is derived using profile parameters (Gaussian, Lorentzian, and pseudo-Voight) [30,31,32,33].

Table 1 illustrates the refined average structural parameters like lattice parameter, X-ray intensity, total number of electrons inside the unit cell, atomic fractional coordinates of S atom and exact composition of the prepared sample using the versatile tool Rietveld refinement. The precise powder X-ray diffraction data is the input for the Rietveld refinement using JANA2006. The output of Rietveld refinement is the experimental structure factor for each diffracting plane (Bragg planes), the total number of electrons in the unit cell, and the final crystallographic model. The quality of refinement is finalized by the factor reliability indices and goodness of fit, which are very low, indicating the perfectness of refinement given in Table 1.

Table 1 Reliability indices and fine-tuned structural parameters for the Rietveld refinement method utilizing JANA2006

Figure 2 shows the fitted XRD profile refined by the Rietveld method, along with insets showing the expanded form of the Bragg peak (101) and the refined structural parameters, respectively. A perfect matching of the observed XRD intensity peaks for all compositions compared to the proposed structural model (space group P-3m1) indicates the fine selection of the structural model, precision of the observed data and accuracy of the refinement process. The weighted reliability indices are very low, ranging from 5.73 to 7.03%, which is another indication of the perfectness of the refinement. The parameter F000 (number of electrons in the unit cell) gradually decreases from 81.261 to 80.285, concerning the increase in Ni doping concentrations, which is a clear indication of the doping of low-charged Ni (Z = 28) in Sn (Z = 50) lattice. The crystal density and the lattice parameter (unit cell volume) do not follow the same trend as crystal density decreases and volume changes randomly for Ni doping. The possible reason for this trend is due to the lack of incorporation of Ni2+/Ni3+ ions in the regular host lattice site instead of possibly occupying non-regular interstitial sites [34]. Compared to others, a noticeable intensity variation is found in the composition x = 0.05 due to the significant interstitial residual charges accumulated at the non-regular lattice sites. The MEM analysis, covered in Sect. 3.3, also re-confirms the same finding. Table 1 shows a little difference between the predicted and observed composition, which is the root cause of the cation deficiency. This cation deficiency is 1.1%, 2.15% and 3.95%, respectively, for the Ni concentrations 2.5%, 5% and 7.5%. This cation deficit has a direct correlation with the UV–visible absorption intensity. The system consisting of 2.5% Ni-doped SnS2 has the least absorption intensity, and the intensity increases with more doping with nickel, as was mentioned in Sect. 3.6, which may be due to the reduction of d-d transitions between 3 and 4d subshells of doped transition metal Ni and host post-transition metal Sn.

Fig. 2
figure 2

Rietveld refined X-ray intensity profile of NixSn1–xS2: a x = 0.025, b x = 0.05, and c x = 0.075 corresponds precisely with the crystallographic model, with the difference between observed and calculated intensity being minimal. As indicated by the inset diagrams, the expanded form of the (101) plane reveals the perfection of refinement

3.3 Electronic structural analysis

The statistical approach, maximum entropy method (MEM), for the determination of the electron density distributions in crystalline materials is reliable because MEM gives less noisy density maps than Fourier synthesis, which suffers from series termination errors and the requirement of a structural model very nearly the same as the true one. The MEM has carried out several high-quality studies applied to crystallographic problems. The MEM can yield a high-resolution density distribution from a limited number of diffraction data. The obtained density distribution gives detailed structure information without using a structural model. The ability of the MEM in terms of a model-free reconstruction of the charge densities from measured X-ray diffraction data can be interpreted as imaging of diffraction data. The method is further developed by combining the MEM with the Rietveld method to create a new sophisticated method of structure refinement in charge density level, the MEM/Rietveld method [35]. The method facilitates the building of a conceptual framework at a finer scale, up to the level of charge density. MEM is an efficient approach for structure analysis using self-consistent structure modeling utilizing MEM electron density imaging and Rietveld powder pattern fitting based on the model derived from MEM charge density. At the start of the iteration, a fundamental structural model is necessary. The Rietveld method using this fundamental structural model is known as the pre-Rietveld analysis. It is well acknowledged that the MEM may provide more helpful information than a presumptive crystal structure model used in pre-Rietveld analysis using just visible structure-factor data. This high-resolution visualization capabilities of charge density proved useful for modeling magnetic material structures.

Constrain equation for electron density distribution is given by

$$ C = \frac{1}{N}\sum \frac{{\left| {F_{{{\text{obs}}}} \left( k \right) - F_{{{\text{cal}}}} \left( k \right)} \right|^{2} }}{{\sigma^{2} \left( {F_{{{\text{obs}}}} \left( k \right)} \right)}}. $$
(2)

The electron density at each pixel is

$$ \rho \left( r \right) = \tau \left( r \right)\exp \left[ {\frac{{\left( {\lambda F_{000} } \right)}}{N} \sum \left[ {\frac{1}{\sigma \left( k \right)}} \right]^{2} } \right]\left| {F_{{{\text{obs}}}} \left( k \right) - F_{{{\text{cal}}}} \left( k \right)} \right|\exp \left( {2\pi jk.r} \right). $$
(3)

Here, \(\rho \left(r\right)\) is the electron density at a certain pixel, N is number of reflections and \(\sigma \)(k) is standard deviation. Further, \(\tau \left(r\right)\) is the prior electron density, \({F}_{{\text{obs}}}\left(k\right)\) and \({F}_{{\text{cal}}}\left(k\right)\) are observed and calculated structure factors. F000 is sum of the atomic numbers of all the elements in the unit cell (total number of electrons in the unit cell).

The maximum entropy method is a mathematical tool based on the entropy principle, which describes the disorder or randomness of a system. The structure factor is a complex quantity measured by the scattering of X-rays or neutron radiation by different lattice planes of the unit cell of a crystal. The Fourier transform of the structure factor produces electron density maps, which reveal concealed information about the crystal structure [36, 37]. For a precise estimate of the electron density mapping, the unit cell is subdivided into (78 × 78 × 128) pixels along the a, b, and c axes. The entropy at each pixel in the unit cell (electron density) is calculated using a zeroth-order single-pixel approximation based on the assumption that the structure factor in each pixel is proportional to electron density [38]. A suitable Lagrangian multiplier (λ) is introduced to converge to the exact solution with the fewest iterations [39]. Dysnomia [40] is used to compute the entropy, considering the uniform prior density throughout the unit cell (F000/V) and the Rietveld refinement-calculated structure factor in each lattice plane. VESTA (Visualization for Electronic and Structural Analysis) [41] is a graphical program used to plot 3D and 2D electron density mapping. The reliability of MEM computations and mapping results has already been reported by several authors [42]. From 3D, the electron clouds' shape, size and density around each ion indicate the type and strength of bonding. The study of the interaction and nature of primary bonding between the neighboring atoms for a particular plan of interest is observed from the 2D charge density contour maps. There are multiple techniques like MEM used for the analysis of variation in activation enthalpy (ΔH*), activation entropy (ΔS*) and Gibbs free energy (ΔG*) using Kissinger–Akahira–Sunose (KAS), Flynn–Wall–Ozawa (FWO), Friedman (FR) method are reported by different authors [43,44,45].

Table 2 gives the numerical results of bond critical density at the bonding and interstitial regions, the type of bonding using total energy density and the charge accumulation at the substitutional and interstitial positions, which is the key to understanding the doping of Ni in SnS2. Figure 3a–f shows a noticeable variation in electron density owing to Ni doping in SnS2 with two-dimensional layers and a 3D view along the c-axis. Figure 3a–c shows a 2D layered structure with highly intra-bonded Sn–S and weak Vander Waals-type inter-layered bonding. All compositions display an elongated non-spherical structure of sulfur. However, 2.5% and 5% Ni compositions show a substantial stretching of sulfur in the intermediate Sn area in opposing directions by alternating sulfur atoms, as illustrated in Fig. 3b, c. Furthermore, random variations in Sn–S bonding and S–S bonding may be seen. The 3D charge density map of NixSn1–xS2: a x = 0.025, b x = 0.05, and c x = 0.075 reflects the hexagonal structure of the samples associated with the Sn/Ni and S positions.

Table 2 MEM reliability indices and numerical bond distance, electron, and total energy density at bond critical sites for NixSn1–xS2: x = 0.025, 0.05, and 0.075
Fig. 3
figure 3

3D MEM electron density mapping of NixSn1–xS2: x = 0.025, 0.05, and 0.075 samples with iso-surface level 0.52 e/Å3, ac displays the 2D layered structure and df 3D MEM view along the c-axis, respectively

Figure 3d–f shows a 3D MEM view of the prepared compositions along the c-axis with hexagonal-shaped Sn–S bonding with dominating S–S bonding in the 2.5% Ni composition. Because of the residual charge buildup in the intermediate regions, all compositions seem to have non-nuclear maxima (NNM). From the MEM peak search analysis, it is found that the total integrated charges inside the unit cell at the (Sn and S) lattice sites are 69.4885 (85.512%), 65.456 (80.757%) and 69.2003 (86.193%), respectively, for x = 0.025, 0.05, 0.075. The charges distributed other than the lattice sites are 11.7725 (14.487%), 15.597 (19.242%) and 11.0847 (13.806%), respectively, for x = 0.025, 0.05, 0.075.

The above calculations give a rough estimate of the overall bonding. The sample x = 0.05 with maximum residual charge distribution (19.242%) other than the lattice sites creates overall bonding covalent and easy electronic movement by hoping mechanism with increased hoping frequency, thereby increasing the electronic conductivity. At the same time, magnetic properties like coercivity and saturation magnetization will be reduced due to the random spin orientation of the interstitial electrons, which cancels the ordered magnetic moments created by the regular lattice sites. Hence, the sample x = 0.025 and 0.075 will have maximum magnetic properties and moderately less electronic conductivity. The sample x = 0.075 is expected to have maximum magnetic coercivity.

Figure 4a–i depicts two-dimensional MEM electron density contour mapping across different bonding planes. The electron density pattern in the (0 2 3) plane is shown in the Fig. 4a–c shows Sn–S and S–S bonding with contour level (0.08–1) e/Å3 and interval 0.02 e/Å3. As demonstrated in Table 2, the Sn–S bond critical point (BCP) displays electron density values of (0.387, 0.414, and 0.347) e/Å3 with a negative total energy density value, confirming covalent bonding [7]. The sample with a 5% Ni composition has the highest covalency due to the increased interstitial Ni2+ charge accumulation. S–S bonding in the horizontal direction for all samples shows covalency, which reduces marginally with Ni content from (0.242 to 0.2) e/Å3. The vertical S–S has the highest electron density (0.423, 0.258, and 0.295) e/Å3 at the BCP for x = 0.025, 0.05, and 0.075, indicating strong covalency for x = 0.05, ionic covalency for x = 0.05, and moderate covalency for x = 0.075, respectively. For the composition x = 0.05, a spherical electron cloud surrounding the Sn atom is also visible, revealing the localized ionic charges. The electron density mapping on the plane (0 0 1) at 4.4147 Å distance from the origin is shown in Fig. 4d–f with contour level (0.08–1) e/Å3 and interval 0.02 e/Å3. Sn–Sn bond stretching and interstitial charge buildup produce non-nuclear maxima (NNM) for varying Ni doping concentrations. No direct Sn–Sn bonding was found; instead, NNM bonding dominates with strong and weak covalency for x = 0.025 and 0.075, respectively, and ionic character for x = 0.05 composition.

Fig. 4
figure 4

2D MEM electron density mapping of various bonding planes of NixSn1–xS2: x = 0.025, 0.05, and 0.075 with numerical electron density at the bond critical point (BCP) embedded on it: a–c (023) plane showing the Sn–S bonding and S–S bonding, contour level 0.2–0.7 e/Å3 interval 0.01 e/Å3, Here, x = 0.05 sample has the highest covalency due to the increased interstitial Ni2+ charge accumulation: d–f (001) plane showing S–S bonding, contour level 0.1–0.5 e/Å3, interval 0.01 e/Å3: gi (001) plane showing the Sn–Sn bonding, contour level 0 to 0.9 e/Å3, interval 0.01 e/Å3. Non-nuclear maxima bonding dominates with strong and weak covalency for x = 0.025 and 0.075

From 3D peak search analysis, x = 0.05 has a high interstitial charge accumulation of around 19%.

Figure 4 (g, h, i) shows the electron density mapping on the plane (0 0 1) at a distance of 5.8876 Å from the origin, with a contour level of (0.09 to 1) e/Å3 and an interval of 0.02 e/Å3. It is discovered that hexagonal-type bonds extend around sulfur ions, with interstitial charge buildup at either end of the hexagonal stretching. The negative total energy density at BCP and the density values shown in Table 2 support the presence of moderate covalent bonding in all compositions.

3.4 Local structural analysis

The pair distribution function (PDF) is the Fourier transform of the total dispersion data derived by X-ray, neutron, or synchrotron radiation, revealing the distribution of nearest atomic pairs within a material. Understanding the size- and composition-dependent structure of transition metal doped chalcogenides is essential since nanosizing and chemical composition may control their energy gap. Unlike conventional crystallography, the local structure, disorder, defects, nano-crystallinity, amorphous nature, and the structure of nanoparticles, nanorods, nanowires, etc., can be precisely analyzed using the PDF method. Even though synchrotron data with high momentum transfer values are required for the analysis of the PDF, we have successfully analyzed using low Q = 6.5 Å−1 (Q = 4πsinθ/λ) X-ray diffraction data, resulting in low-reliability index values. Raw X-ray diffraction data is converted into a pair distribution function using the PdfgetX [46] program, with a radial distance with a reference atom ranging from 1.9 Å to 10 Å and a step size of 0.02 Å. The 500 Å range of the PDF is utilized for particle size estimation. The experimental PDF profile is fitted with the crystallographic model using PDFgui [47] by refining various parameters like lattice parameters, atomic position and occupancy, thermal vibration, and particle broadening.

The intensity of the scattered X-rays by the atoms is given as (after absorption, polarization, multiple scattering, and normalization correction),

$$ I\left( Q \right) = \sum f_{i} \left( {\overrightarrow {Q} } \right)f_{j} \left( {\overrightarrow {Q} } \right)\left\langle { \left\langle {\exp \left( {{i\vec{Q}}} \right.. \left({{\varvec{r}}_{{\varvec{i}}} - {\varvec{r}}_{{\varvec{j}}} } \right)} \right\rangle } \right\rangle, $$
(4)

where \(f_{j} \left( Q \right)\) is the scattering amplitude of single atom i, ri is the position of the scattering vector and \(< < \exp (i\vec{Q}.\left( {r_{i} - r_{j} } \right)) > >\) is the quantum and thermal average \(\vec{Q}\) is given by

$$ \vec{Q} = K_{f} - K_{i} ;\;\;Q = \left| {\vec{Q}} \right| = 2 \left| {K_{fi} } \right|\sin \theta ,\;\;{\text{if}}\;K_{f} = \, K_{i} , $$

where Ki and Kf represent the momenta of incident and scattered X-ray photons respectively and the diffraction angle \(\theta\). The average value of structure factor is given as

$$ S\left( {\vec{Q}} \right) = \frac{{I \left( {\overrightarrow {Q} } \right)}}{{\left\langle {f \left( {\overrightarrow {Q} } \right)} \right\rangle ^{2} }} + \frac{{\left[ { < f \left( {\overrightarrow {Q} } \right) > ^{2} - \left\langle {f \left( {\overrightarrow {Q} } \right)^{2} } \right\rangle } \right]}}{{\left\langle {f \left( {\overrightarrow {Q} } \right)} \right\rangle ^{2} }}. $$
(5)

Here < f(Q) > is the compositional average.

The data will be treated in real space, by Fourier transforming the data, using the Eq. (1.14) in 3D gives the atomic Pair Distribution Function.

$$ \rho \left( r \right) = { }\rho_{0} \frac{1}{{2 \pi^{2} r}}\int {\vec{Q}\left[ {s\left( {\vec{Q}} \right) - 1} \right]\;\sin \left( {\;\overrightarrow {Q } r} \right) {\text{d}} \vec{Q}} . $$
(6)

Here \(\rho \left( r \right)\) is the Average (atomic) number density (average number of atoms with respect to distance) and r is the distance from reference atom. Equation (1.14) is expressed as follows, gives the atomic pair distribution function,

$$ G(r) = 4\pi r\left[ {\rho \left( r \right) - { }\rho_{0} } \right] = \frac{2}{\pi }\int {\vec{Q}\left[ {S\left( {\vec{Q}} \right) - 1} \right]\sin \left( {\vec{Q}r} \right){\text{d}}\vec{Q}} . $$
(7)

Figure 5a–c illustrates the fitted PDF profiles for NixSn1–xS2: x = 0.025, 0.05, 0.075, with weighted reliability indices Rw ranging from 13 to 16%, which are low in terms of powder XRD-based PDF refinements. PDF yields nearly identical lattice parameters and follows the trend observed with other methodologies. In Fig. 5d–f, the first five nearest neighbor distances are plotted, and they all vary randomly concerning Ni doping concentrations.

Fig. 5
figure 5

Pair distribution analysis for NixSn1–xS2: x = 0.025, 0.05, and 0.075: ac Show the fitted PDF profile with the crystallographic model for x = 0.025, 0.05, and 0.075, df unit cell model with closest neighbor distances inserted, gi show the observed PDF profile. A long-range PDF up to 50 nm shows the typical crystallite size with minimal undulation points. PDF crystallite size range is similar to Debye Scherrer and Halder Wagner plot values

PDF bond length analysis reveals additional bond length distribution within the unit cell beyond the regular lattice sites (given in supplementary Table, Table S1), which MEM analysis confirms as non-nuclear maxima and interstitial charge accumulation. This charge accumulation is mainly accountable for the electrical conduction mechanism due to the reduction of mean free path and hopping length in Ni-doped SnS2 systems and the optical band gap engineering due to the formation of intermediate donor and acceptor entrapment levels. An envelope function attenuates the PDF signal as the crystallite size increases. The envelope function represents the geometry of a particle, which is typically spherical but can also represent other forms and size distributions. The initial region with minimal and constant attenuation in the PDF envelope determines the average crystallite size of the prepared samples, as shown in Fig. 5g–i. The approximated crystallite size values are comparable to those derived from another technique [48].

3.5 Magnetic hysteresis analysis

One reliable and accurate method of analysis of magnetic properties, such as saturation and spontaneous magnetization, coercive field, retentivity, and squareness ratio of the hysteresis loop of prepared powder samples, is vibration sample magnetometer (VSM) with maximum accuracy. Further, VSM can interpret the type and strength of magnetism. This work uses VSM data with an applied magnetic field varying from 0 to 15 kOe in steps of nearly 500 Oe at room temperature. The magnetic hysteresis curve is given in Fig. 6 with inset (a) and (b) showing the expanded form for the estimation of coercivity and retentivity and the Arrott plot, showing spontaneous magnetization, respectively. Compared to the diamagnetic nature of pure SnS2, Ni doping has a transition to soft ferromagnetism with saturation magnetization, and coercivity ranges from 0.2233 to 0.4726 emu/g and 74.5 to 93.5 Oe, respectively. The retentivity and squareness ratio are very small.

Fig. 6
figure 6

VSM hysteresis curve demonstrates the fluctuation in magnetization caused by varying Ni doping concentrations in the SnS2 lattice: The enlarged form of magnetic hysteresis a shows coercivity and retentivity, while the Arrott plot b demonstrates the origin of spontaneous magnetization. x = 0.05 have minimum saturation magnetization confirms interstitial charge accumulation

The spontaneous magnetization of various Ni-doped samples is given as the M value in the inset table of Fig. 6. It is found that the 7.5% Ni-doped SnS2 sample has the optimum magnetic properties with saturation magnetization and coercivity 0.4657 emu/g and 93.5 Oe, respectively, useful for magnetic semiconducting applications. One possible mechanism for the increase in ferromagnetic behavior with Ni doping is the creation of Sulfur vacancies and the induced spin polarization of Ni3+ ions in the SnS2 lattice. The above argument can be explained based on the bound polaron model in which the electrons trapped in sulfur vacancies will interact with the localized spins of Ni3+ ions, forming a coupling two-dimensional layered chain. Also, the sulfur vacancy bound in Ni2+ producing Ni3+ ions or the Ni2+ ions at the interstitial positions around the polarizing field of the crystal creates ferromagnetism via sulfur vacancy/bound polaron interaction. The adjacent layers may have collinear or non-collinear magnetization, which influences the net magnetization of the sample.

Another hypothesized mechanism for the origin of ferromagnetism is given based on the oxidation states of interstitial Ni2+, substitutional Ni3+, and host Sn4+, which are 2 + , 3 + , and 4 + , respectively. Substituting stoichiometric compositions of Ni for Sn in SnS2 is anticipated to result in a cation charge deficiency. An excess of anions results in additional electrons in the system, which may be distributed at both regular and interstitial lattice sites. MEM analysis determined that the x = 0.05 sample exhibited the maximum charge accumulation in the interstitial locations. An excess of anions results in electrons with magnetic moments that may be distributed at interstitials rather than substitutional/regular lattice sites. The orientation of these extra electrons magnetic spins may be collinear or non-collinear with the adjacent layers, which define the ferromagnetic strength. We can conclude from the correlation between our experimental VSM and MEM results that assigning electrons only to regular lattice sites will result in the greatest ferromagnetism. As the accumulation of interstitial charge facilitates the hopping movement of electrons within the crystal with less hopping length and higher hopping frequency, the electronic conductivity increases.

3.6 Energy band gap analysis

Optical energy band gap, the signature of electronic conductivity in a semiconductor material, could be analyzed using the UV–visible–NIR spectroscopic technique, which measures transmittance, reflectance and absorbance of electromagnetic radiation of wavelength ranging from 200 to 2500 nm [49]. It can also determine the chemical concentrations, conversions, optical constants, and many other properties. In the present study, the optical absorbance of the prepared samples is obtained in the wavelength range from 200 to 1400 nm with step size 1 nm. A slight increase in optical absorbance and a red shift on the absorption edges concerning an increase in Ni2+/Ni3+ doping concentrations is observed. These absorption edges provide information, such as band gap, impurity center, oxygen vacancy or deficiency, and surface roughness. Figure 4 depicts the transition region between 300 and 450 nm that can be ascribed to the photoexcitation of electrons from the valence band to the conduction band. The inset of Fig. 4 depicts the energy gap resulting from Tauc's relation, as depicted by the following equation:

$$ (\alpha h\nu )^{1/n} = \, A \, \left( {hv - E_{{\text{g}}} } \right). $$
(8)

In this expression, h, α, ν, and Eg represent Plank's constant, the absorption coefficient, and the radiation frequency, respectively. For a direct transition between bands, n must be set to 1/2. Extrapolating the line segment between (αhν)2 and  yields the band gap values. NixSn1–xS2 (x = 0.025, 0.05, 0.075) band gaps are compared in the inset of Fig. 7. Pure SnS2 has a band gap of 2.35 electron volts (eV). As Ni doping concentration increases, the absorption in the visible region shifts from 530 to 580 nm in wavelength, and the energy gap values fall from 2.32 eV to 2.13 eV [22], which may be due to the introduction of the intermediate energy levels in the forbidden energy gap of SnS2 band. High optical absorption in the visible band and energy gap tuning with Ni doping may be critical for solar-powered optical applications.

Fig. 7
figure 7

UV–Visible absorbance spectra of NixSn1–xS2: x = 0.025, 0.05, and 0.075 demonstrating the variation of optical absorption in the UV–visible border region, with x = 0.075 composition exhibiting the highest absorption: The Tauc plot given in inset indicates the energy band gap tuning owing to Ni doping

3.7 Photoluminescence analysis

Analyzing the quantity of light emitted by a substance when it is excited by a particular monochromatic radiation, slightly more significant than the energy gap, is the objective of photoluminescence analysis. It can be used to investigate materials electronic band structure and optical properties. Ni doping can influence the magnetic and optical properties of SnS2 in several ways, like (a) inducing spin polarization and ferromagnetism, (b) reducing the band gap and red-shifting the absorption edges, (c) increasing the absorption coefficient in the visible region, and (e) producing additional peaks in the infrared region. The amount of doping, the location of Ni atoms, and the hybridization of the Ni:3d, S:3p, and Sn:4d orbitals influence these effects. With the excitation wavelength of 400 nm (3.01 eV), the free electrons' valence band to conduction band excitation was induced.

Figure 8a–c shows the Pl spectrum de-convoluted into four major Gaussian bands, namely (A1, A2, A3 and A4) in the visible band region nearly at λ = 482 nm, 526 nm, 540 nm and 606 nm using origin software. There is not much contribution from Ni doping to the PL emission, and very little change in the emission wavelength is seen. Figure 8 inset (d) illustrates the energy band diagram for the charge carrier relaxation process involved in the photoexcitation of the sample. Inset (a) shows the schematic relaxation process involved in the photo exciton of the sample NixSn1–xS2 (x = 0.025, 0.05, and 0.075). The conduction band and valance band energy are calculated from the Eq. 9 and 10. For finding electronegativity value (X) for NixSn1–xS2 (x = 0.025, x = 0.05, x = 0.075), it is calculated using absolute electronegativity values of Sn, Ni, and S from Pearson's experimental data and (Ee ~ 4.5 eV) is the free electrons energy on hydrogen scale and Eg value taken from UV-DRS analysis. From Eqs. (9) and (10), pure SnS2 possesses CBE of -0.115 eV and VBE of 2.235 eV

$$ C_{{{\text{BE}}}} = \, X - 4.5 - \left( {E_{{\text{g}}} /2} \right) $$
(9)
$$ V_{{{\text{BE}}}} = \, X - 4.5 + \left( {E_{{\text{g}}} /2} \right), $$
(10)
Fig. 8
figure 8

ac NixSn1–xS2: x = 0.025, 0.05, and 0.075, photo-luminescent emission spectrum excited at 400 nm, inset, d energy level diagram illustrating characteristic emission and e Achromatic point on the CIE color space diagram (light blue-yellow)

CBE, VBE, Eg and X are conduction band energy, valance band energy, band gap, and electro-negativity of the material respectively. The PL emission can be used to estimate the Fermi levels in the forbidden region due to the doping. Free electrons are excited from the valence band to the conduction band at a wavelength (λ) of 400 nm (3.01 eV). Non-radiative emission occurs between the donor and intermediate energy levels (µ1, µ2, µ3). The PL blue emission is due to the self-trapped excitons (localized electron–hole pairs confined by defects or distortions in the lattice). Inset (d) shows excited states have low energies, and the excitons radiative recombination rate increases due to the defects, leading to blue PL emission. Ni doping narrows the band gap, which increases the blue PL emission. When Ni atoms are substituted for Sn atoms in SnS2, the band gap is effectively shrunk due to introducing new energy levels, and the absorption edges shift to red. This indicates that blue PL emission may be generated by the excitation of electrons across the band gap by lower-energy photons [22]. The band gap of SnS2 nanoparticles is roughly 2.35 eV, suggesting that their size may be responsible for the green PL emission. Figure 8. Inset (d) depicts electrons and holes that may become trapped in the crystal structure if sulfur vacancies are present. Light excites electrons from the valence band to the conduction band in SnS2 nanoparticles, leaving behind holes. The sulfur vacancies/interstitials may ensnare some of these electrons and holes, turning them into radiative recombination centers. The green emission wavelength is proportional to the energy gap between the trap states and the band edges [50], and Ni2+/Ni3+ ions are incorporated into the Sn4+ lattice; they produce Sn vacancies, which are responsible for the orange PL emission [51]. Colors in the CIE system, as illustrated in the inset (a) of Fig. 8, are defined by a brightness parameter Y and two-color coordinates (x, y) that specify the location of the point on the chromaticity diagram. Using the spectral power distribution (SPD) of the light emitted from a colored object and human eye sensitivity curves, this method assesses color more accurately than the Munsell and Ostwald methods. Inset (a) of Fig. 8 shows that the CIE coordinates for 2.5%, 5%, and 7.5% Ni-doped SnS2 are in the bluish yellow range.

3.8 EPR analysis

EPR spectroscopy is indispensable for comprehending radical reactions, electron transfer processes, and transition metal catalysis, all linked to unpaired electrons reactivity. The graph of microwave energy absorption versus applied magnetic field is used to identify paramagnetic substances and investigate the nature of chemical bonds within molecules by identifying unpaired electrons and their interaction with their immediate surroundings. Electron spin resonance spectroscopy corroborates the impurities of semiconducting materials responsible for semiconductors conducting properties. Figure 9 depicts the X-band EPR spectrum of NixSn1–xS2: x = 0.025, 0.05, and 0.075 systems at ambient temperature, along with their corresponding g factors. The ESR spectral simulations reveal the presence of two distinct paramagnetic species, substitutional Ni3+ and interstitial Ni2+ [52].The ions oxidation states are determined using the practical g factor values. ESR spectra of Ni3+-doped SnS2 absorption at g factors between 2.102 and 2.124 are g perpendicular and g parallel as Ni2+ interstitial factors [53]. 2.5% and 7.5% Ni-doped SnS2 contain substitutional unpaired Ni3+ ions, which increase magnetization and result in mild ferromagnetism, and Ni2+ interstitial ions, decreasing magnetic properties. In contrast, compositions containing 5% Ni have the highest concentration of Ni2+ interstitial ions, which have no unpaired electrons to increase magnetism and further reduce the active spin coupling between adjacent Ni3+ substitutional ions, leading to the reduction of ferromagnetism.

Fig. 9
figure 9

ESR spectra of NixSn1–xS2: x = 0.025, 0.05, and 0.075, reveal the presence of substitutional Ni3+ ions and interstitial Ni2+ ions. x = 0.05 have highest concentration of Ni2+ interstitial ions

3.9 Surface structural analysis

The scanning electron microscope (SEM) is a common technique for imaging the microstructure and morphology of all prepared samples, including particle size and shape. Using energy dispersive X-ray (EDX) analysis, the elemental composition of prepared samples is determined. Figure 10a–c displays SEM images of NixSn1–xS2 with x values of 0.025, 0.05, and 0.075. All the samples consist of hexagonal, two-dimensional disks with nearly identical diameters and thicknesses. The above may be the result of anisotropic growth in numerous crystallographic orientations. The growth rate along the c-axis (perpendicular to the layers) is significantly slower than the growth rate along the a and b axes (parallel to the layers), leading to the formation of narrow and flat hexagonal nanoplates [54]. Due to Ni doping, the extraordinary homogeneity of the typical nano-disk in Ni-doped SnS2 is slightly deformed. Figure 10d–f displays EDX results indicating the presence of Sn, Ni, and S atoms, demonstrating the samples integrity. No other impurity elements, even in trace quantities, were detected. Figure 10 insets (d, e, f) depict the average particle diameter histogram. NixSn1–xS2: x = 0.025, 0.05, and 0.075 exhibit hexagonal nanoplates with thicknesses of a few nanometers and diameters ranging from 275 to 439 nm [24]. Due to the crystals unique layered structure, its hexagonal development pattern can be attributed to its layered structure.

Fig. 10
figure 10

Images from SEM/EDX for the samples NixSn1–xS2 (x = 0.025, 0.05, and 0.075): Inset (ac) SEM images with hexagonal plate like morphology and cf EDX images with particle size histogram and elemental composition table

4 Conclusion

The optical and magnetic characteristics of SnS2 doped with 2.5%, 5%, and 7.5% nickel (Ni), a kind of two-dimensional layered transition metal dichalcogenide, are directly related to the electronic structure obtained from X-ray diffraction (XRD) data using the maximum entropy method (MEM) approach. The shift from diamagnetism to soft ferromagnetism may be effectively elucidated using MEM charge density and peak search analysis. This change is achieved by substituting Ni3+ ions and reducing the magnetism caused by interstitial Ni2+ ions. The best magnetic characteristics for magnetic semiconducting applications are seen in a 7.5% Ni-doped SnS2 sample, which exhibits a saturation magnetization of 0.4657 emu/g and a coercivity of 93.5 Oe. The capacity of Ni to adjust the energy gap within the range of 2.32–2.20 eV might be of utmost importance for optical devices driven by solar energy. PDF analysis of bond length distribution reveals supplementary bond length distribution outside the typical lattice sites inside the unit cell, verified by MEM analysis as non-nuclear maxima and charge buildup in interstitial regions. The accumulation of charges is mainly responsible for the electrical conduction process in Ni-doped SnS2 systems. This is owing to the decrease in hopping length and the engineering of the optical band gap, which occurs due to the establishment of intermediate donor and acceptor entrapment levels. Rietveld, MEM, and PDF techniques used in this study may be applied to examine any material's mean electronic and local structure for various purposes. Moreover, the MEM electronic structure is an experimental approach comparable in quality to density functional theory and other techniques based on entropy. The PDF approach is better than other methods because it uses actual space measurements.