Skip to content

Commit

Permalink
add more side chain option, switch H cap with CH2 cap (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
daico007 authored Mar 11, 2024
1 parent 81c9346 commit 783baf3
Show file tree
Hide file tree
Showing 8 changed files with 145 additions and 3 deletions.
12 changes: 9 additions & 3 deletions surface_coatings/chains/nbdac_polymer.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
from surface_coatings.monomers.mnbdac.side_chains import AminoPropyl
from surface_coatings.monomers.mnbdac.terminal_groups import Acetaldehyde

# Create custom ch2 cap for the polymer
# clone this when provided to the polymer
ch2_cap = CH2()
ch2_cap.remove(
ch2_cap["down"]
)

class O(mb.Compound):
"""An oxygen with two ports attached."""
Expand Down Expand Up @@ -91,7 +97,7 @@ class pNBDAC(mb.Compound):
terminal_groups: mb.Compound or list of Compounds (len 2)
Terminal groups which will be matched with side chains
cap_front : bool, optional, default=True
Cap the front of the polymer (NBDAC end)
Cap the front of the polymer (NBDAC end) with a CH2
cap_end : bool, optional, default=False
Cap the end of the polymer (Silane end)
buffer : str, optional, default=None
Expand Down Expand Up @@ -185,15 +191,15 @@ def __init__(
self.labels["down"] = self["Polymer"]["down"]

if cap_front:
front_cap = H()
front_cap = mb.clone(ch2_cap)
self.add(front_cap, "front_cap")
mb.force_overlap(
move_this=front_cap,
from_positions=front_cap["up"],
to_positions=self["up"],
)
if cap_end:
end_cap = H()
end_cap = mb.clone(ch2_cap)
self.add(end_cap, "end_cap")
mb.force_overlap(
move_this=end_cap,
Expand Down
4 changes: 4 additions & 0 deletions surface_coatings/monomers/mnbdac/side_chains/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
"""__init__ file for mNBDAC side chains."""
from .nh import NH
from .amino_methyl import AminoMethyl
from .amino_ethyl import AminoEthyl
from .amino_propyl import AminoPropyl
from .o import O
from .methanol import Methanol
from .cresol import Cresol
from .propanol import Propanol
from .toluidine import Toluidine
24 changes: 24 additions & 0 deletions surface_coatings/monomers/mnbdac/side_chains/amino_methane.mol2
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@<TRIPOS>MOLECULE
RES
7 6 1 0 1
SMALL
NO_CHARGES
@<TRIPOS>CRYSIN
7.4607 6.9693 6.6397 90.0000 90.0000 90.0000 1 1
@<TRIPOS>ATOM
1 C -0.5716 0.0451 -0.0118 C 1 RES
2 N 0.8404 -0.0115 -0.3628 N 1 RES
3 H -0.7036 -0.1026 1.0824 H 1 RES
4 H -0.9886 1.0330 -0.3004 H 1 RES
5 H -1.1240 -0.7488 -0.5574 H 1 RES
6 H 1.2108 -0.9362 -0.0445 H 1 RES
7 H 1.3367 0.7211 0.1945 H 1 RES
@<TRIPOS>BOND
1 1 2 1
2 1 3 1
3 1 4 1
4 1 5 1
5 2 6 1
6 2 7 1
@<TRIPOS>SUBSTRUCTURE
1 RES 1 RESIDUE 0 **** ROOT 0
23 changes: 23 additions & 0 deletions surface_coatings/monomers/mnbdac/side_chains/amino_methyl.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""AminoMethyl side chain class."""
import mbuild as mb


class AminoMethyl(mb.Compound):
"""AminoEthyl side chain class."""

def __init__(self):
super().__init__()
mb.load(
"amino_methane.mol2",
compound=self,
backend="gmso",
relative_to_module=self.__module__,
infer_hierarchy=False,
)

to_remove = [self[4], self[6]]
for part in to_remove:
self.remove(part)

self.labels["terminal"] = self["Compound[0]"].labels.pop("port[1]")
self.labels["side"] = self["Compound[0]"].labels.pop("port[3]")
22 changes: 22 additions & 0 deletions surface_coatings/monomers/mnbdac/side_chains/methanol.mol2
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@<TRIPOS>MOLECULE
RES
6 5 1 0 1
SMALL
NO_CHARGES
@<TRIPOS>CRYSIN
7.5955 6.7325 6.5627 90.0000 90.0000 90.0000 1 1
@<TRIPOS>ATOM
1 C -0.3566 -0.0316 -0.0168 C 1 RES
2 O 0.9584 -0.4372 -0.2657 O 1 RES
3 H -0.5386 0.0288 1.0783 H 1 RES
4 H -1.0555 -0.7739 -0.4544 H 1 RES
5 H -0.5477 0.9586 -0.4845 H 1 RES
6 H 1.5400 0.2553 0.1430 H 1 RES
@<TRIPOS>BOND
1 1 2 1
2 1 3 1
3 1 4 1
4 1 5 1
5 2 6 1
@<TRIPOS>SUBSTRUCTURE
1 RES 1 RESIDUE 0 **** ROOT 0
23 changes: 23 additions & 0 deletions surface_coatings/monomers/mnbdac/side_chains/methanol.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""Methanol side chain class."""
import mbuild as mb


class Methanol(mb.Compound):
"""Methanol side chain class."""

def __init__(self):
super().__init__()
mb.load(
"methanol.mol2",
compound=self,
backend="gmso",
relative_to_module=self.__module__,
infer_hierarchy=False,
)

to_remove = [self[3], self[5]]
for part in to_remove:
self.remove(part)

self.labels["terminal"] = self["Compound[0]"].labels.pop("port[1]")
self.labels["side"] = self["Compound[0]"].labels.pop("port[3]")
21 changes: 21 additions & 0 deletions surface_coatings/monomers/mnbdac/side_chains/nh.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"""A NH with 2 ports."""

import numpy as np

import mbuild as mb


class NH(mb.Compound):
"""A NH with 2 ports."""

def __init__(self):
super().__init__()

self.add(mb.load("N", smiles=True))

h_to_remove = [self[2], self[3]]
for h in h_to_remove:
self.remove(h)

self.labels["side"] = self["Compound[0]"].labels.pop("port[1]")
self.labels["terminal"] = self["Compound[0]"].labels.pop("port[3]")
19 changes: 19 additions & 0 deletions surface_coatings/monomers/mnbdac/side_chains/o.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""An oxygen with 2 ports."""

import numpy as np

import mbuild as mb


class O(mb.Compound):
"""A oxygen with 2 ports."""

def __init__(self):
super().__init__()
self.add(mb.Particle(name="O", element="O"))

self.add(mb.Port(anchor=self[0]), "side")
self["side"].translate(np.array([0, 0.07, 0]))

self.add(mb.Port(anchor=self[0]), "terminal")
self["terminal"].translate(np.array([0, -0.07, 0]))

0 comments on commit 783baf3

Please sign in to comment.