<#448 Unable to find definition of model (OSDI) > ...
# ihp-sg13g2
g
#448 Unable to find definition of model (OSDI) Issue created by adarshvp123 I am trying to run osdi model on ngspiceshared. in a python container with proper .Bashrc and .spiceinit definitions. The OSDI files were compiled using openvaf and paths are given in .spiceinit. But its showing unable to find the model definition. i am attaching the code below
Copy code
`import os
import PySpice.Logging.Logging as Logging
logger = Logging.setup_logging()

from PySpice.Spice.Netlist import Circuit
from PySpice.Unit import u_V, u_ns
import matplotlib.pyplot as plt


PDK_ROOT = os.getenv('PDK_ROOT', '/wang/users/adavp/cluster_home/IHP-Open-PDK')
PDK = os.getenv('PDK', 'ihp-sg13g2')


model_path = os.path.join(PDK_ROOT, PDK, 'libs.tech', 'ngspice', 'models')
stdcell_path = os.path.join(PDK_ROOT, PDK, 'libs.ref', 'sg13g2_stdcell', 'spice')

circuit = Circuit('SG13G2 A21O Gate Test')


mos_model_file = os.path.join(model_path, 'cornerMOSlv.lib')
if os.path.exists(mos_model_file):
    circuit.lib(mos_model_file, 'mos_tt')
    print("Included MOS model library:", mos_model_file)
else:
    print("Warning: MOS model library not found at", mos_model_file)


spiceinit_file = os.path.expanduser('~/.spiceinit')
if os.path.exists(spiceinit_file):
    circuit.include(spiceinit_file)
    print("Included spiceinit file:", spiceinit_file)
else:
    print("Warning: spiceinit file not found at", spiceinit_file)


std_cell_file = os.path.join(stdcell_path, 'sg13g2_stdcell.spice')
if os.path.exists(std_cell_file):
    circuit.include(std_cell_file)
    print("Included standard cell file:", std_cell_file)
else:
    print("Warning: standard cell file not found at", std_cell_file)

circuit.V('vdd', 'VDD', circuit.gnd, 1.2 @ u_V)


circuit.PulseVoltageSource('A1', 'A1', circuit.gnd,
    initial_value=0 @ u_V, pulsed_value=1.2 @ u_V,
    delay_time=1 @ u_ns, rise_time=10 @ u_ns, fall_time=10 @ u_ns,
    pulse_width=2 @ u_ns, period=4 @ u_ns)

circuit.PulseVoltageSource('A2', 'A2', circuit.gnd,
    initial_value=0 @ u_V, pulsed_value=1.2 @ u_V,
    delay_time=2 @ u_ns, rise_time=10 @ u_ns, fall_time=10 @ u_ns,
    pulse_width=2 @ u_ns, period=4 @ u_ns)

circuit.PulseVoltageSource('B1', 'B1', circuit.gnd,
    initial_value=0 @ u_V, pulsed_value=1.2 @ u_V,
    delay_time=3 @ u_ns, rise_time=10 @ u_ns, fall_time=10 @ u_ns,
    pulse_width=2 @ u_ns, period=4 @ u_ns)


try:
    circuit.X('U1', 'sg13g2_a21o_1', 'A1', 'A2', 'B1', 'VDD', circuit.gnd, 'XOUT')
    print("Instantiated subcircuit: sg13g2_a21o_1")
except Exception as e:
    print("Error instantiating subcircuit sg13g2_a21o_1:", e)
    exit(1)


    analysis = circuit.simulator(temperature=25, nominal_temperature=25).transient(step_time=10 @ u_ns, end_time=10 @ u_ns)
except Exception as e:
    print("\n[ERROR] ngspice simulation failed:")
    print(e)
    print("\nNetlist:\n", circuit)
    exit(1)


plt.figure(figsize=(10, 6))
plt.plot(analysis.time, analysis.XOUT, label='XOUT')
plt.plot(analysis.time, analysis.A1, '--', label='A1')
plt.plot(analysis.time, analysis.A2, '--', label='A2')
plt.plot(analysis.time, analysis.B1, '--', label='B1')
plt.xlabel('Time [s]')
plt.ylabel('Voltage [V]')
plt.title('Transient Analysis of SG13G2 A21O Gate')
plt.grid()
plt.legend()
plt.tight_layout()
plt.show()
` I am getting following error log [Image](https://private-user-images.githubusercontent.com/57490073/432780461-92056271-2411-4e98-9fc8-b3bafde5b9d4.PNG?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDY3OTk3NDAsIm5iZiI6MTc0Njc5OTQ0MCwicGF0aCI6Ii81NzQ5MDA3My80MzI3ODA0NjEtOTIwNTYyNzEtMjQxMS00ZTk4LTlmYzgtYjNiYWZkZTViOWQ0LlBORz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTA1MDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwNTA5VDE0MDQwMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWU1MjRiNmUwYzMyODQ1ZWZhNDUxZjI2YjllNzA3YjUzNDE2ZmMxZDA5YjE1MjdhNTIyYTFlYmI5M2RmNzRkMmQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.NUq6hXXV0pycRweFC5JX4c6ODYp3oNEIbCoOl7JT0sw) IHP-GmbH/IHP-Open-PDK