Skip to content

Polymerization of monomer with two heads and tails #35

@supriyonaskar

Description

@supriyonaskar

Dear Developers,
I would like to build a polymer (Like PIM-1) with two heads and two tails. I can find examples with single head and tail and procedures to assign them. However, I am finding it difficult to define two heads in the code. Could you please provide some examples?

If you can please edit the following code to assign two heads that would be great.

def monomer():

    s = system.read_mol('My.mol'))
    m = s.molecules[1]
    f = forcefield.Gaff2()
    
    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] #head 1
    c2 = s.particles[2]  #head 2

    c5 = s.particles[5] #tail 1
    c5 = s.particles[6]  #tail 2

    
    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 c1 else b.b
            s.particles.remove(pb.tag, update=False)
            break
            
    s.remove_spare_bonding()

    c1.linker = 'head'
    #c2.linker= 'head'
    c5.linker = 'tail'
    #c6.linker= 'tail'
    
    lmps.quick_min(s, min_style='fire')
    
    s.add_particle_bonding()
    
    return s

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions