# How to Add User-Defined Unit Cell to Unit Cell Library

If you have your own unit cell data (phase and transmittance) simulated by RCWA/FDTD, such as [MAXIM](https://data.mendeley.com/datasets/352jpd593h/1) or [Meep](https://meep.readthedocs.io/en/latest/), for example, you can add them to the Unit Cell Library in SMD PRO. Here is how to:

{% hint style="success" %}
If you're adding unit cell data that were used for SMD Tool, skip Step 1 and go to Step 2.
{% endhint %}

{% stepper %}
{% step %}
**Generate a unit cell data template for SMD PRO.**

Click 'MACROS' in the sidebar in SMD PRO. Select the shape of your unit cell (top view) and click GENERATE to generate the template. If needed, click the info icon (<img src="/files/mlusm1YxOrvgh7qpyPt4" alt="" data-size="line">) to see details about unit cell shapes available in SMD PRO.

<figure><img src="/files/98ndxAIMye4gF3wVRNYO" alt="" width="545"><figcaption></figcaption></figure>
{% endstep %}

{% step %}
**Replace data in the template with your unit cell data.**

Replace data values in the template file with your unit cell data (instructions are provided in the file). If you are using unit cell data that were used for SMD Tool, convert the data format so it's compatible with SMD PRO. See [How to Convert SMD Tool's Unit Cell Data for SMD PRO](/docs/smd-pro/topical-discussions/how-to-convert-smd-tools-unit-cell-data-for-smd-pro.md) for details.
{% endstep %}

{% step %}
**Load unit cell data to unit cell library.**

In BUILD module, click 'ADD UNIT CELL' and select the unit cell data file that you just edited in Step 2. Enter unit cell information on the right side of the library view and click 'SAVE DATA'. If needed, click the info icon (<img src="/files/mlusm1YxOrvgh7qpyPt4" alt="" data-size="line">) next to parameters to see details.
{% endstep %}

{% step %}
**Check your unit cell info in unit cell library.**

Your unit cell data is now added to the library and ready for use to build metalenses! Optionally, you can delete the .csv file as it is not needed anymore.

If you need to edit some info (e.g., you entered a wrong wavelength by mistake), then select the unit cell to edit and correct the value(s) and click SAVE DATA. When prompted, click 'OK' to replace the existing data.

{% hint style="warning" %}
If you found out some values in the unit cell data file (.csv) were incorrect after loading it to the library, then you must remove the unit cell from the library and start from Step 2 again. To remove, select the unit cell and click the trash icon <img src="/files/NgyFZJtPmL1rlgVhV9cW" alt="" data-size="line">.
{% endhint %}
{% endstep %}
{% endstepper %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://simplemetalens.gitbook.io/docs/smd-pro/topical-discussions/how-to-add-user-defined-unit-cell-to-unit-cell-library.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
