Adds functional groups to carbon nanotube geometries.
There are many tools for generating carbon nanotube (CNT) structures for modelling, but adding functional groups may be tedious. Nanotube Functionalizer automates this process easier by doing the following:
- Importing CNT and functional group molecular geometries from XYZ files.
- Fitting a cylinder to the CNT [1].
- Choosing carbon molecules that will be bonded to functional groups.
- Calculating the number of substituents for a given weight fraction.
- Positioning the substituents normal to the CNT surface at the correct bond distance away.
- Writing an XYZ geometry file of the final, substituted molecule.
- The unfunctionalized CNT geometry should be very clean, i.e. as un-optimized as possible, as this improves the cylinder fit. The XYZ file should only contain the CNT without any other molecules present.
- Numpy
- Scipy
- Obtain a nanotube geometry using your favourite software and export in XYZ format. E.g. Avogadro's nanotube builder.
- Generate a geometry for the functional group of interest and also export in XYZ format. Note where the axes align relative to the functional group.
-
In your script, generate a
Nanotube
object from the XYZ file:from Nanotube import Nanotube n = Nanotube() n.fromXYZ(xyz_path='<PATH_TO_CNT>.xyz', \ unit='angstrom')
Specify the distance unit to be the same as that of the geometry files.
-
Add the functional group to the nanotube with the
functionalize()
method:n.functionalize(xyz_path='<PATH_TO_FUNC>.xyz', \ wt_frac=0.1, \ method='random', \ bond_length=0, \ normal=np.array([0, 0, 1]), \ origin=np.array([0, 0, 0]))
Where the arguments to
functionalize()
are:xyz_path
: path to the functional group geometry file.wt_frac
: weight fraction of substituent in the functionalized molecule. Nanotube Functionalizer currently supports groups with H, C, N, O, F, P, S, and Cl atoms.method
: algorithm to choose the carbons bonded to the substituents. Currently, onlyrandom
(randomly chosen) andstride
(every nth atom) are supported.bond_length
: distance from the target carbon to the origin of the functional group. In this example, the origin was already placed 1 C-N bond length away, sobond_length
can be set to zero.normal
: the normal vector for the functional group. In this example, the normal vector is along the +z axis.origin
: an offset for the functional group origin.
-
Write the result to an XYZ file:
n.toXYZ('<PATH_TO_OUT>.xyz')
-
View the output in a molecular editor.
[1] D. Eberly, “Least Squares Fitting of Data by Linear or Quadratic Structures.” Geometric Tools, ch. 7, pp. 38–51, 2019.