Esempio n. 1
0
def monomer():
    try:
        s = system.read_pubchem_smiles('CC')
    except:
        import os
        s = system.read_mol(
            os.path.join(os.path.dirname(os.path.realpath(__file__)),
                         os.pardir, 'CC.mol'))
    f = forcefield.Gaff()
    s.apply_forcefield(f)

    c1 = s.particles[1]
    c2 = s.particles[2]
    c1.linker = 'head'
    c2.linker = 'tail'

    for b in c1.bonds:
        if b.a.elem == 'H' or b.b.elem == 'H':
            pb = b.a if b.b is c1 else b.b
            s.particles.remove(pb.tag, update=False)
            break

    for b in c2.bonds:
        if b.a.elem == 'H' or b.b.elem == 'H':
            pb = b.a if b.b is c2 else b.b
            s.particles.remove(pb.tag, update=False)
            break

    s.remove_spare_bonding()

    lmps.quick_min(s, min_style='fire')

    s.add_particle_bonding()

    return s
Esempio n. 2
0
def monomer():
    try:
        s = system.read_pubchem_smiles('CCC(OCCSSCCO)=O')
    except:
        import os
        s = system.read_mol(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir, 'CC(C)C(=O)OC.mol'))
    f = forcefield.Gaff()
    s.apply_forcefield(f)

    c3 = s.particles[8]
    c4 = s.particles[11]

    for b in c3.bonds:
        if b.a.elem == 'H' or b.b.elem == 'H':
            pb = b.a if b.b is c3 else b.b
            s.particles.remove(pb.tag, update=False)
            break

    for b in c4.bonds:
        if b.a.elem == 'H' or b.b.elem == 'H':
            pb = b.a if b.b is c4 else b.b
            s.particles.remove(pb.tag, update=False)
            break

    s.remove_spare_bonding()

    c3.linker = 'head'
    c4.linker = 'tail'

    lmps.quick_min(s, min_style='cg')

    s.add_particle_bonding()

    return s
Esempio n. 3
0
def monomer():
    try:
        import os
        s = system.read_mol(
            os.path.join(os.path.dirname(os.path.realpath(__file__)),
                         os.pardir, 'disGde.mol'))
    # s = system.read_pubchem_smiles('O=C(OCCSSCCC(O)=O)CC')
    except:
        import os
        s = system.read_mol(
            os.path.join(os.path.dirname(os.path.realpath(__file__)),
                         os.pardir, 'CC(C)C(=O)OC.mol'))
    f = forcefield.Gaff()
    s.apply_forcefield(f)

    c3 = s.particles[1]
    c4 = s.particles[2]

    for b in c3.bonds:
        if b.a.elem == 'H' or b.b.elem == 'H':
            pb = b.a if b.b is c3 else b.b
            s.particles.remove(pb.tag, update=False)
            break

    for b in c4.bonds:
        if b.a.elem == 'H' or b.b.elem == 'H':
            pb = b.a if b.b is c4 else b.b
            s.particles.remove(pb.tag, update=False)
            break

    s.remove_spare_bonding()

    c3.linker = 'head'
    c4.linker = 'tail'

    lmps.quick_min(s, min_style='cg')

    s.add_particle_bonding()
    s.apply_charges(f, charges='gasteiger')
    signal = 0
    for pb in s.particles:
        if pb.elem == 'O' and 1 in pb.bond_orders and len(set(
                pb.bond_orders)) == 1:
            signal += 1
        if signal == 2 and pb.elem == 'O' and 1 in pb.bond_orders and len(
                set(pb.bond_orders)) == 1:
            pb.charge = pb.charge - 1
    return s
Esempio n. 4
0
def monomer():
    try:
        s = system.read_pubchem_smiles('CCc1=cc=cc=c1')
    except:
        import os
        s = system.read_mol(
            os.path.join(os.path.dirname(os.path.realpath(__file__)),
                         os.pardir, 'CCc1=cc=cc=c1.mol'))
    m = s.molecules[1]
    f = forcefield.Gaff()

    for b in s.bonds:
        if b.a.bonds.count == 3 and b.b.bonds.count == 3:
            b.order = 4

    s.apply_forcefield(f)

    c1 = s.particles[1]
    c5 = s.particles[5]

    for b in c1.bonds:
        if b.a.elem == 'H' or b.b.elem == 'H':
            pb = b.a if b.b is c1 else b.b
            s.particles.remove(pb.tag, update=False)
            break

    for b in c5.bonds:
        if b.a.elem == 'H' or b.b.elem == 'H':
            pb = b.a if b.b is c5 else b.b
            s.particles.remove(pb.tag, update=False)
            break

    s.remove_spare_bonding()

    s.set_box(padding=10)

    c1.linker = 'head'
    c5.linker = 'tail'

    lmps.quick_min(s, min_style='fire')

    s.add_particle_bonding()

    return s
Esempio n. 5
0
from pysimm import system, lmps, forcefield, gasteiger

# create empty system
s = system.System()

# create new molecule in our system
m = s.molecules.add(system.Molecule())

# retrieve GAFF parameters
f = forcefield.Gaff()

# get a copy of the c3 particle type object from GAFF
# get method returns a list, we need the first element
gaff_c3 = f.particle_types.get('c3')[0].copy()

# now we need to add this particle type to our system
s.particle_types.add(gaff_c3)

# we'll first make the carbon atom at the origin
# we'll include gasteiger charges later
c1 = s.particles.add(
    system.Particle(type=gaff_c3, x=0, y=0, z=0, charge=0, molecule=m))

# get hc particle type object from GAFF
gaff_hc = f.particle_types.get('hc')[0].copy()

# add hc particle type to system
s.particle_types.add(gaff_hc)

# now we'll add 4 hydrogen atoms bonded to our carbon atom
# these atoms will be placed randomly 1.5 angstroms from the carbon atom
Esempio n. 6
0
def polymer_chain(length):
    mon = monomer()
    polym = random_walk(mon, length, forcefield=forcefield.Gaff())
    return polym