Command line script (sknano.scripts.nanogen)

CLI to sknano.generators tools.

This module allows for easy structure generation from the command line.

> nanogen --help

  usage: nanogen [-h] [--basis ELEMENT1 ELEMENT2] [--bond BOND] [--fname FNAME]
                 [--structure-format {data,xyz}] [--verbose] [--debug]

  optional arguments:
    -h, --help            show this help message and exit
    --basis ELEMENT1 ELEMENT2
                          2 element symbols or atomic numbers of the two atom
                          basis (default: ['C', 'C'])
    --bond BOND           Bond length between nearest-neighbor atoms. Must be in
                          units of Angstroms. (default: 1.42)
    --fname FNAME         structure file name
    --structure-format {data,xyz}
                          structure file format (default: xyz)
    --verbose             verbose output
    --debug               debug output
    --version             show nanogen's version number and exit

sknano.scripts.nanogen.nanogen(generator_class=None, fname=None, structure_format='xyz', **kwargs)[source][source]

Generate nano-structure data.


generator_class : str

nano-structure generator class

fname : str, optional

structure file name

structure_format : str, optional

output file format


The following command generates a graphene sheet with a 10 nm long armchair edge and 1 nm long zigzag edge and saves the data in the LAMMPS data format.:

> nanogen --structure-format data graphene 10 1

This command will generate a \((20, 0)\) SWNT, 5 unit cells long and saves the data in xyz format.:

> nanogen swnt --Ch 20 0 --nz 5


The nanogen script calls the nanogen function and neither the script nor the function allow for generating multiple structures per call. It’s easy to do this using the scripting capabilities of the shell or from within an interactive Python session.

For example, if you have a list of chiralities that you want structure data for, you can do something like this from within an interactive session:

>>> from sknano.structures import generate_Ch_list
>>> from sknano.generators import SWNTGenerator
>>> # Generate your list of (n, m) chiralities
>>> Ch_list = generate_Ch_list(ni=5, nf=25, mi=0, mf=25, handedness='right')
>>> for Ch in Ch_list:
...     SWNTGenerator(Ch).save(structure_format='data')