Carbon nanotube filled with water

A carbon nanotube filled with water, in water. The nanotube is a fixed molecule along the z axis, crossing the periodic boundary of the box, so that it is infinite; the water fills the inside of the tube, and the box around it.

The packed system (drag to rotate, scroll to zoom), built in the Julia script section below.

Files: cnt.pdb, water.pdb, and the input file nanotube.inp.

The nanotube

The nanotube is an armchair (12,12) tube, with a radius of 8.14 Å, and 49.2 Å long (20 periods of 2.46 Å along its axis, 960 carbon atoms). Its length is the length of the box along z, so that the tube is continuous across the periodic boundary.

It is the rectangular cell of graphene (2.46 × 4.26 Å, with 4 carbon atoms) rolled into a cylinder: for an armchair (n, n) tube, n cells along the circumference, with the C–C bonds along it, and the tube periodic along its axis with a period of 2.46 Å:

The script that builds cnt.pdb (click to expand)
using PDBToolsfunction build_nanotube(; n = 12, nz = 20, a = 2.46, d = 1.42)    cell = [(0.0, 0.0), (a / 2, d / 2), (a / 2, 3d / 2), (0.0, 2d)]    circumference = n * 3d    radius = circumference / (2π)    Lz = nz * a    atoms = Atom{Nothing}[]    for i in 0:nz-1, j in 0:n-1, (z, y) in cell        θ = 2π * (j * 3d + y) / circumference        push!(atoms, Atom(;            name = "C", resname = "CNT", resnum = 1, chain = "A",            x = radius * cos(θ), y = radius * sin(θ), z = i * a + z - Lz / 2,            pdb_element = "C",        ))    end    return atomsendwrite_pdb("cnt.pdb", build_nanotube())

The numbers of molecules

The atoms of water can get no closer than tolerance (2 Å) to the atoms of the nanotube, so inside the tube they are within a radius of about 6 Å. A cylinder of this radius and 49.2 Å long has 5560 ų, which would hold about 185 molecules at 1 g/mL; water confined in a tube this narrow is less dense, and 150 molecules are packed. Outside the tube, beyond a radius of 10.5 Å, the box of 40 × 40 × 49.2 Å has 61700 ų, which holds 2060 molecules at 1 g/mL (0.0334 molecules per ų).

Water inside and outside the tube

#
# A carbon nanotube (armchair, (12,12), radius 8.14 Å) filled with water, in
# water (1 g/mL), in a periodic box. The nanotube is along z, and crosses the
# periodic boundary: it is infinite.
#
tolerance 2.0
output nanotube.pdb
pbc -20. -20. -24.6 20. 20. 24.6

# Uncomment to write only the initial placement of the molecules to the output file,
# without packing them (to check the constraints):
# check_initial_placement

# The nanotube, kept at the coordinates of the file
structure cnt.pdb
  number 1
  fixed 0. 0. 0. 0. 0. 0.
end structure

# Water inside the tube. The cylinders start at z = -100 with a length of 200,
# longer than the box: they cross the periodic boundary along z.
structure water.pdb
  number 150
  inside cylinder 0. 0. -100. 0. 0. 1. 6. 200.
end structure

# Water outside the tube
structure water.pdb
  number 2060
  outside cylinder 0. 0. -100. 0. 0. 1. 10.5 200.
end structure

The cylinders (center of one cap, axis, radius and length) are longer than the box: with periodic boundary conditions, the atoms are evaluated in the box, where only the side of the cylinders matters.

Check the initial placement first

Uncomment the check_initial_placement line of the input file, and run it as below (see Checking the initial placement): the initial placement is written to the output file (nanotube.pdb) in a fraction of a second (see it at the end of the Julia script section). When the water is in the tube and around it, comment the line again, and run the packing.

Packing

packmol nanotube.inp

The packing takes a fraction of a second.

Julia script

using Packmol, PDBToolscnt = structure_type("cnt.pdb";    number = 1,    fixed = ([0., 0., 0.], [0., 0., 0.]),)water_inside = structure_type("water.pdb";    number = 150,    constraints = [InsideCylinder([0., 0., -100.], [0., 0., 1.], 6., 200.)],)water_outside = structure_type("water.pdb";    number = 2060,    constraints = [OutsideCylinder([0., 0., -100.], [0., 0., 1.], 10.5, 200.)],)system = PackmolSystem([cnt, water_inside, water_outside];    output = "nanotube.pdb",    tolerance = 2.0,    unitcell = [40. 0. 0.; 0. 40. 0.; 0. 0. 49.2], # centered at the origin    check_initial_placement = true, # first, only the initial placement)packmol(system)system.status
:not_packed

The initial approximation, with the visualize function of PDBTools.jl (drag to rotate, scroll to zoom): the water is in the tube and around it, but molecules may overlap:

show_system(system) = visualize(get_atoms(system),    "resname CNT" => (style = :sticks, color = "gray"),    "water" => (style = :sticks, water = true);    unitcell = UnitCell(system.unitcell),    unitcell_origin = -sum(eachcol(system.unitcell)) / 2,    rotate = [(:z, 30), (:x, -70)],)show_system(system)

Then the packing:

system.check_initial_placement = falsepackmol(system)show_system(system)