QuantumATK Forum

QuantumATK => Scripts, Tutorials and Applications => Topic started by: Metwally on May 14, 2020, 10:50

Title: Monomer builder
Post by: Metwally on May 14, 2020, 10:50
Dear All,
I have tried to build a custom monomer to build a polymer from it. I have assigned the atom tags but however when i run the job manager to build the polymer i just obtain single atoms of the monomer spread over the simulation box (as in attached images)
This is the link for the monomer i wanna build: https://www.tcichemicals.com/US/en/p/T2324
Could anyone help me with building it and send it to me so i can perform my work.
Here is the script of monomer builder


# Define elements
elements = [Carbon, Hydrogen, Hydrogen, Hydrogen, Carbon, Carbon, Oxygen,
            Oxygen, Carbon, Hydrogen, Hydrogen, Hydrogen, Carbon, Hydrogen,
            Hydrogen, Hydrogen, Carbon, Carbon, Nitrogen, Carbon, Carbon,
            Carbon, Carbon, Hydrogen, Hydrogen, Carbon, Carbon, Carbon,
            Hydrogen, Hydrogen, Hydrogen, Hydrogen, Hydrogen, Hydrogen,
            Hydrogen, Hydrogen, Hydrogen, Hydrogen, Hydrogen, Hydrogen,
            Hydrogen, Hydrogen, Hydrogen, Hydrogen]

# Define coordinates
cartesian_coordinates = [[ 0.375454544044, -0.550296300696, -1.19112966141 ],
                         [ 1.498130804278, -0.553769992983, -1.235645483796],
                         [ 0.015076498947, -0.660731195301, -2.249877898814],
                         [ 0.078359119201, -1.492402611849, -0.654387490663],
                         [-0.192256041585,  0.727045606338, -0.494656980881],
                         [ 0.238824752315,  0.782241479947,  0.941167091477],
                         [ 1.681236256086,  0.891895073067,  0.960414976647],
                         [-0.464535789712,  0.73458120668 ,  1.929887570653],
                         [ 0.285901788252,  1.986964956685, -1.283802535458],
                         [-0.322133599188,  2.901155015836, -1.041618891082],
                         [ 1.355498716243,  2.256438506545, -1.069672185475],
                         [ 0.216638949126,  1.847667888554, -2.396807262321],
                         [-1.749820533609,  0.672998473636, -0.603417291908],
                         [-2.171440557953, -0.295453463123, -0.218711130136],
                         [-2.248555806024,  1.488582554161, -0.011397314411],
                         [-2.113943652157,  0.781923153153, -1.660767923561],
                         [ 3.099059239597,  2.432718847601,  3.88427829877 ],
                         [ 2.50824618903 ,  2.352682360634,  2.47928610305 ],
                         [ 4.239552071908,  1.436292029347,  4.073331400598],
                         [ 2.014443327979,  2.15279523886 ,  4.901342749792],
                         [ 3.599041955226,  3.836179874975,  4.147875394193],
                         [ 3.808801050864,  0.014446982685,  3.723864276032],
                         [ 2.077933095606,  0.930824283622,  2.129320932693],
                         [ 3.253560106633,  2.697016140939,  1.750973071471],
                         [ 1.64947059032 ,  3.028262712575,  2.400850338679],
                         [ 3.21814275878 , -0.065858032298,  2.318934869776],
                         [ 2.781162018951, -0.459581578941,  4.728067414271],
                         [ 4.994701598393, -0.918815397396,  3.832631096795],
                         [ 2.855813799298, -1.081978980032,  2.12824267094 ],
                         [ 4.004988606416,  0.136792747928,  1.581173225793],
                         [ 1.231231611875,  0.640188816831,  2.76414833671 ],
                         [ 5.19560958873 ,  1.77565812067 ,  4.413455666599],
                         [ 4.020089432662,  3.889304177202,  5.151865762571],
                         [ 4.367134328928,  4.091361358647,  3.41779570992 ],
                         [ 2.770101126522,  4.538959621192,  4.063866106916],
                         [ 2.434593020709,  2.209526391563,  5.905511879744],
                         [ 1.219757591553,  2.891602197213,  4.797715107989],
                         [ 1.607597178116,  1.155593736104,  4.733517832751],
                         [ 3.201342810111, -0.402912486756,  5.732227036177],
                         [ 1.895873493666,  0.173507914018,  4.66838701179 ],
                         [ 2.505935011217, -1.490841218353,  4.507039181071],
                         [ 5.413551579469, -0.858545062586,  4.837136950252],
                         [ 4.672102719844, -1.940901695064,  3.63421387674 ],
                         [ 5.75280046551 , -0.629343070566,  3.104900577158]]*Angstrom

# Set up configuration
molecule_configuration = MoleculeConfiguration(
    elements=elements,
    cartesian_coordinates=cartesian_coordinates
    )

# Add tags
molecule_configuration.addTags('ENDH_OPLS_CT_4',
molecule_configuration.addTags('HEAD_CONNECT',   
molecule_configuration.addTags('HEAD_GROUP_A',   [1])
molecule_configuration.addTags('OPLS_CT_4',      [8, 12, 19, 20, 26, 27])
molecule_configuration.addTags('OPLS_CT_40',     [16, 21])
molecule_configuration.addTags('OPLS_CT_5',      [0, 17, 25])
molecule_configuration.addTags('OPLS_CT_8',      [12])
molecule_configuration.addTags('OPLS_CT_94',     [22])
molecule_configuration.addTags('OPLS_C_19',      [5])
molecule_configuration.addTags('OPLS_HC_1',      [ 1,  2,  3,  9, 10, 11, 13, 14, 15, 23, 24, 28, 29,
                                                  30, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43])
molecule_configuration.addTags('OPLS_HC_34',     [30])
molecule_configuration.addTags('OPLS_H_34',      [31])
molecule_configuration.addTags('OPLS_NT_3',      [18])
molecule_configuration.addTags('OPLS_OS_11',     [6])
molecule_configuration.addTags('OPLS_O_14',      [7])
molecule_configuration.addTags('TAIL_CONNECT',   [4])
molecule_configuration.addTags('TAIL_GROUP_A',   [12])
molecule_configuration.addTags('TAIL_GROUP_B',   [8])

# Add bonds
bonds = [[ 0,  1],
         [ 0,  2],
         [ 0,  3],
         [ 0,  4],
         [ 4,  5],
         [ 4,  8],
         [ 4, 12],
         [ 5,  6],
         [ 5,  7],
         [ 8,  9],
         [ 8, 10],
         [ 8, 11],
         [12, 13],
         [12, 14],
         [12, 15]]
molecule_configuration.setBonds(bonds)
Thanks.
Title: Re: Monomer builder
Post by: mlee on May 18, 2020, 03:20
When I looked at your monomer, you missed bonds information. Your monomer has 44 atoms. But you defined bonds partially. I recommend to save your customized monomer database correctly.
The below part for bonds is what I tested. I can see all bonds and polymer after polymer builder.
Let me know if you have a trouble.

# Add bonds
bonds = [[ 0,  1],
         [ 0,  2],
         [ 0,  3],
         [ 0,  4],
         [ 4,  5],
         [ 4,  8],
         [ 4, 12],
         [ 5,  6],
         [ 5,  7],
         [ 6, 22],
         [ 8,  9],
         [ 8, 10],
         [ 8, 11],
         [12, 13],
         [12, 14],
         [12, 15],
         [16, 17],
         [16, 18],
         [16, 19],
         [16, 20],
         [17, 22],
         [17, 23],
         [17, 24],
         [18, 21],
         [18, 31],
         [19, 35],
         [19, 36],
         [19, 37],
         [20, 32],
         [20, 33],
         [20, 34],
         [21, 25],
         [21, 26],
         [21, 27],
         [22, 25],
         [22, 30],
         [25, 28],
         [25, 29],
         [26, 38],
         [26, 39],
         [26, 40],
         [27, 41],
         [27, 42],
         [27, 43]]
monomer_1.setBonds(bonds)