PCM Simulation API Reference

class JMAKModel

Implements the Johnson-Mehl-Avrami-Kolmogorov crystallization kinetics model for phase change materials.

__init__(params: Optional[Dict] = None)

Initialize JMAK model with material parameters.

params dict, optional
Dictionary containing model parameters (Ea, k0, n)
Example:
from pcm import JMAKModel

# Initialize with default GST parameters
model = JMAKModel()

# Initialize with custom parameters
custom_params = {
    'Ea': 1.8,  # eV
    'k0': 1e16,  # 1/s
    'n': 3.0     # Avrami exponent
}
model = JMAKModel(params=custom_params)
rate_constant(T: float) → float

Calculate temperature-dependent crystallization rate constant.

T float
Temperature in Kelvin
Returns: Rate constant k(T) in 1/s
Example:
# Calculate rate at 500K
k = model.rate_constant(500)
print(f"Rate constant at 500K: {k:.2e} 1/s")
simulate_isothermal(T: float, t_array: np.ndarray, X0: float = 0.0) → np.ndarray Core Method

Simulate isothermal crystallization at constant temperature.

T float
Temperature in Kelvin
t_array np.ndarray
Time array in seconds
X0 float, optional
Initial crystalline fraction (default: 0.0)
Returns: Array of crystalline fractions X(t)
Example:
import numpy as np

# Simulate crystallization at 500K
time = np.logspace(-9, -2, 100)  # 1ns to 10ms
X = model.simulate_isothermal(T=500, t_array=time)

# Plot results
import matplotlib.pyplot as plt
plt.semilogx(time, X)
plt.xlabel('Time (s)')
plt.ylabel('Crystalline Fraction')
plt.show()

class PCMDevice

Complete PCM device model with electro-thermal coupling and phase change dynamics.

simulate_voltage_pulse(voltage_waveform: np.ndarray, t_grid: np.ndarray, X0: float = 0.0, enable_ts: bool = True) → Dict Core Method

Simulate device response to voltage pulse including thermal and phase change dynamics.

voltage_waveform np.ndarray
Voltage pulse waveform in volts
t_grid np.ndarray
Time grid in seconds
X0 float, optional
Initial crystalline fraction
enable_ts bool, optional
Enable threshold switching (default: True)
Returns: Dictionary with time, temperature, resistance, phase, and current arrays
Example:
from pcm import PCMDevice, create_reset_pulse

device = PCMDevice()

# Create RESET pulse
voltage, time = create_reset_pulse(V_reset=3.0, t_width=50e-9)

# Simulate device response
result = device.simulate_voltage_pulse(voltage, time)

# Access results
T_max = np.max(result['temperature'])
final_state = result['phase'][-1]
print(f"Peak temperature: {T_max:.0f} K")
print(f"Final state: {'Amorphous' if final_state < 0.5 else 'Crystalline'}")
mix_resistivity(X: Union[float, np.ndarray], T: Union[float, np.ndarray]) → Union[float, np.ndarray]

Calculate device resistance based on phase state and temperature.

X float or np.ndarray
Crystalline fraction (0 to 1)
T float or np.ndarray
Temperature in Kelvin
Returns: Device resistance in Ohms

class ThresholdSwitching

Models threshold switching behavior and I-V characteristics of PCM devices.

sweep_iv(X_state: float = 0.0, Vmax: float = 3.0, steps: int = 600) → Dict Core Method

Perform quasi-static I-V sweep with threshold switching.

X_state float, optional
Initial crystalline fraction (0=amorphous, 1=crystalline)
Vmax float, optional
Maximum sweep voltage in volts
steps int, optional
Number of voltage steps
Returns: Dictionary with voltage and current arrays

class Reliability

Reliability analysis including retention and endurance modeling.

retention_arrhenius(temps_C: Optional[np.ndarray] = None) → Dict

Calculate retention times using Arrhenius model.

temps_C np.ndarray, optional
Temperature array in Celsius
Returns: Dictionary with temperatures and retention times
endurance_weibull(n_samples: int = 5000) → Dict

Generate Weibull distribution for endurance analysis.

n_samples int, optional
Number of Monte Carlo samples
Returns: Dictionary with cycles and failure probability

Utility Functions

Helper functions for pulse generation, data I/O, and analysis.

create_reset_pulse(V_reset: float = 3.0, t_width: float = 50e-9, t_rise: float = 5e-9, t_fall: float = 5e-9) → Tuple[np.ndarray, np.ndarray]

Generate RESET pulse waveform for amorphization.

Example:
# Generate 50ns RESET pulse at 3V
voltage, time = create_reset_pulse(V_reset=3.0, t_width=50e-9)
create_set_pulse(V_set: float = 1.5, t_width: float = 500e-9, t_rise: float = 20e-9, t_fall: float = 20e-9) → Tuple[np.ndarray, np.ndarray]

Generate SET pulse waveform for crystallization.

Example:
# Generate 500ns SET pulse at 1.5V
voltage, time = create_set_pulse(V_set=1.5, t_width=500e-9)
save_results(data: Dict, filename: str, format: str = 'csv')

Save simulation results to file.

data dict
Simulation results dictionary
filename str
Output filename
format str, optional
Output format ('csv', 'json', 'hdf5')

JavaScript API

Client-side JavaScript functions for interactive simulations.

PCMSimulator.runJMAK(params)

Run JMAK crystallization simulation in browser.

Example:
// Initialize simulator
const simulator = new PCMSimulator();

// Set parameters
const params = {
    Ea: 1.8,  // eV
    k0: 1e16, // 1/s
    n: 3.0,   // Avrami exponent
    T: 500    // Temperature in K
};

// Run simulation
const result = simulator.runJMAK(params);

// Plot results
Plotly.newPlot('plot-div', result.traces, result.layout);
PCMSimulator.simulatePulse(voltage, duration)

Simulate voltage pulse response.

Example:
// Simulate RESET pulse
const resetResult = simulator.simulatePulse(3.0, 50e-9);
console.log(`Peak temperature: ${resetResult.T_max} K`);

// Simulate SET pulse
const setResult = simulator.simulatePulse(1.5, 500e-9);
console.log(`Final crystallinity: ${setResult.X_final}`);