cnt_polyeth2 = kappa.attach(cnt, [polyeth]*4, indices2)

cnt_teflon1 = kappa.attach(cnt, [teflon]*2, indices1)
cnt_teflon2 = kappa.attach(cnt, [teflon]*4, indices2)

kappa.plot.bonds(cnt_polyeth2)
kappa.plot.bonds(cnt_teflon1)
kappa.plot.bonds(cnt_teflon2)

"""
Explanation: What we've just done is attach a polyethylene molecule (length unit 2 as specified) to the atomic indices we specified in indices1.
Let us make more molecules then export their gro files.
mol0 is 1 polyethylene connection on each interface
mol1 is 2 polyeth connections
mol2 is 1 teflon connection
mol3 is 2 teflon connections
all connections are length 2
End of explanation
"""


for count, mol in enumerate([cnt_polyeth1, cnt_polyeth2, cnt_teflon1, cnt_teflon2]):
    name = 'mol{}'.format(count)
    mol.hydrogenate()
    pdb = kappa.md.generate.pdb(mol)
    gro = kappa.md.generate.gro(mol, fn=name+'.gro')
    itp = kappa.md.generate.restrains(mol, fn=name+'.itp')
    kappa.md.save_file(pdb,'.', name+'.pdb')

"""
Explanation: You may wish to stop plotting matplotlib inline and look at these molecules in 3d.
Now let's export.
End of explanation
"""


