Set up the configuration#
To execute input files (run simulations) you need a valid nextnano license and a configuration file for nextnanopy that points at your nextnano executables, databases and license.
The configuration is stored as .nextnanopy-config in your home directory
(e.g. C:\Users\Your_User\.nextnanopy-config on Windows), with one section per
nextnano product. It is created with empty defaults the first time you access
nextnanopy.config. You only have to come back to it when you renew your
license or update your nextnano installation.
Config instructions#
The three ways below all produce that same file — pick whichever you prefer.
If you already run your simulations from nextnanomat, it has every path on file and can write them out in the nextnanopy config format, so you do not have to look any of them up.
In nextnanomat, call Generate nextnanopy config file from the main menu.
Save the file it writes to your home directory, overwriting any
.nextnanopy-configalready there.
Do the same again after a nextnano update or a license renewal: nextnanopy reads whatever file it finds and never refreshes one by itself, so an old copy would go on being used with its stale paths.
If you have no
.nextnanopy-configyet, run this simple script to write one with all options blank. It also prints where the file is:import nextnanopy as nn print(nn.config.fullpath)
Open that file in any text editor and fill in the absolute paths for the products you have installed. The file is plain INI:
[nextnano++] exe = C:\Program Files\nextnano\2026_07_03\nextnano++\bin\nextnano++_Intel_64bit.exe license = C:\Users\Your_User\Documents\nextnano\License\License_nnp.lic database = C:\Program Files\nextnano\2026_07_03\nextnano++\database\database.nnp outputdirectory = C:\Users\Your_User\Documents\nextnano\Output threads = 0
The other sections — nextnano3, nextnano.NEGF,
nextnano.NEGF_classic, nextnano.MSB and nextnanoevo — take
the same options and can be left empty if you do not use those products.
Set the paths from Python and save them once.
Option A — adapt the ready-made template
Download templates/config_nextnano.py from the repository.
Adjust the three paths at the top — your license folder, your output folder and your nextnano installation folder. That block is all you have to touch:
#++++++++++++++++++++++++++++++++++++++++++++++++++ # Specify your license folder #++++++++++++++++++++++++++++++++++++++++++++++++++ path_license = r"C:\Users\homer.simpson\Documents\nextnano\License" #++++++++++++++++++++++++++++++++++++++++++++++++++ # Specify your output folder #++++++++++++++++++++++++++++++++++++++++++++++++++ path_nextnano_output = r"C:\Users\homer.simpson\Documents\nextnano\Output" #++++++++++++++++++++++++++++++++++++++++++++++++++ # Specify your nextnano installation folder #++++++++++++++++++++++++++++++++++++++++++++++++++ path_nextnano = r"C:\Program Files\nextnano\2026_07_03" # nextnano++, nextnano3, nextnano.NEGF and nextnano.MSB software # NO NEED TO CHANGE THE FOLLOWING -----------------------------
Run it. Everything below that line is built from those three paths, so all products are configured at once and the file is saved for you.
Option B — write your own
If you have only one product installed, or want the paths to come from
somewhere else, set them yourself with nn.config.set(section, option,
value) and save once. For nextnano++ alone:
import nextnanopy as nn
nn.config.set('nextnano++', 'exe', r'C:\Program Files\nextnano\2026_07_03\nextnano++\bin\nextnano++_Intel_64bit.exe')
nn.config.set('nextnano++', 'license', r'C:\Users\Your_User\Documents\nextnano\License\License_nnp.lic')
nn.config.set('nextnano++', 'database', r'C:\Program Files\nextnano\2026_07_03\nextnano++\database\database.nnp')
nn.config.set('nextnano++', 'outputdirectory', r'C:\Users\Your_User\Documents\nextnano\Output')
nn.config.save() # without this the change is lost when the process ends
Repeat the same calls with 'nextnano3', 'nextnano.NEGF' or
'nextnano.MSB' for the other products if you use them. Use absolute paths, and prefix
them with r as shown so that backslashes are not read as escape
sequences. See NNConfig for everything nn.config
can do.
Note
Editing the file and running a script both need the paths themselves. If you activated your license through nextnanomat, that is where to read them off: open Tools → Options, where the Simulation tab holds the executable path of each nextnano product, and the Database and License tabs hold the other two.
The options#
Every section of the file is named after a nextnano product and holds the
options below. Which of them a section carries depends on the product —
nextnanopy.config.get_options(section) lists the ones it actually has.
Option |
Meaning |
Sections it appears in |
|---|---|---|
|
Absolute path to the simulator executable to run. |
all but |
|
Absolute path to the license file of that product. |
all |
|
Absolute path to the material database. |
all but |
|
Folder the results are written to. |
all but |
|
Number of threads the simulator is started with, passed on as
|
|
|
How much debug output the simulator writes to the console and log file.
The bigger the number, the more output. Default |
|
|
|
|
|
|
|
|
Same meaning as |
|
Only the paths need filling in to run a simulation; the rest have working defaults. A section you do not use can be left empty.
For the full story — reading options back, using a different configuration file per input file, resetting to the defaults — follow Tutorial 0 - Set up the configuration, or see Configuration for the API.