# .lib/.include : LTspice -- Include a Library/Include Another File

Using ".lib/.include(.inc)", you can load SPICE models provided by component manufacturers or your own SPICE models for simulation.

TOC

## Difference between ".lib" and ".include(.inc)"

The ".lib" and ".include(.inc)" are dot commands to load SPICE model files.
(".inc" is an abbreviation of ".include". The function is the same.)

Functionally, they are exactly the same, but there are some minor nuances that make them different, such as:

Difference between ".lib" and ".include(.inc)"
• .lib: Used for SPICE models consisting of multiple parts, extension "*.lib", etc.
• .include(.inc): Used for SPICE models consisting of a single part, extension "*.sub", etc.

Of course, since they are functionally identical, either command can be used to load a SPICE model file.

The following article explains the different types of SPICE models and extensions.

## ".lib/.include(.inc)" syntax

The ".lib/.include(.inc)" syntax is as follows:

For SPICE models provided by component manufacturers or your own SPICE models, you need to load them using the ".lib/.include(.inc)".

.lib <FileName>

.include <FileName>

.inc <FileName>

Depending on where you store the SPICE model file, you may need to include the path as well as the file name in the syntax.

There are three ways to enter a "file name" as follows:

How to enter a "File Name"
1. File name only
2. Path after folder "sub"
3. Absolute path

### File name only

In the ".lib/.include(.inc)" syntax, there are two input patterns for "file name only" as follows:

Enter "file name only"
1. Save SPICE model to folder "sub"
2. Save SPICE models in the same folder as schematic symbols

When LTSpice is installed, a folder "sub" for storing SPICE models and a folder "sym" for storing schematic symbols are automatically generated in the following locations.

C:\Users\USERNAME\Documents\LTspiceXVII\lib

If you save the SPICE model you want to load in this folder "sub", you can use the ".lib/.include(.inc)" syntax and just need "file name only".

Also, if you save the SPICE model you want to load in the same folder as the associated schematic symbol (extension: *asy), you can use the ".lib/.include(.inc)" syntax and just need the "file name only".

Usually, most schematic symbols are stored in the folder "sym", so you can save the SPICE model you want to load there, but not necessarily together in the folder "sym".

For example, if the file name of the SPICE model you want to load is "2N4923.lib", the ".lib/.include(.inc)" syntax is as follows:

.lib 2N4923.lib

* ".include(.inc)" can also be used instead of ".lib".

### Path after folder "sub"

If you create an arbitrary folder under the folder "sub" described in the section "File name only" and save the SPICE model you want to load, the ".lib/.include(.inc)" syntax requires you to enter "path after folder "sub".

For example, if you create a folder "mylib" in the folder "sub" and save the SPICE model "2N4923.lib", to load "2N4923.lib", enter the ".lib/.include(.inc)" syntax as follows:

.lib mylib\2N4923.lib

* ".include(.inc)" can also be used instead of ".lib".

Also, if you created the folder "ON_Semi" in the folder "mylib" under the folder "sub" and saved the SPICE model "2N4923.lib", to load "2N4923.lib", enter the ".lib/.include(.inc)" syntax as follows:

.lib mylib\ON_Semi\2N4923.lib

* ".include(.inc)" can also be used instead of ".lib".

### Absolute path

If you saved the SPICE model you want to load in a location other than the "file name only" and "path after folder 'sub'" described so far, you need to enter an "absolute path" for the ".lib/.include(.inc)" syntax.

For example, if you saved the SPICE model "2N4923.lib" on your desktop, to load "2N4923.lib", enter the syntax ".lib/.include(.inc)" as follows:

.lib C:\Users\USERNAME\Desktop\2N4923.lib

* ".include(.inc)" can also be used instead of ".lib".

## Examples of ".lib/.include(.inc)" simulation

To use ".lib/.include(.inc)", you need to know in advance how to add SPICE models.

The following article explains how to add "device models" and "subcircuit models" of SPICE models provided by component manufacturers and how to use ".lib/.include(.inc)".

However, if you use the ".lib/.include(.inc)" syntax to load a SPICE model, it is very difficult because you have to place it in the schematic every time.

Actually, you can load SPICE models without using the ".lib/.include(.inc)" syntax. For device models, data can be written directly to the data file, and for subcircuit models, they can be set in the "Symbol Atribute Editor".

Please refer to the above article for a detailed explanation of these as well.