Closed ELambden closed 2 years ago
Hello hello,
Please note that vermouth does not support running on python2, and py2 is EOL. Please upgrade to py3.
You indeed need to add new molecules to 1) universal, 2) target ff (martini3001 in this case), and 3) the mapping between them. Since you added your new files to the py2 folder (rather than py3) it's probably not the folder the code is looking in. So please purge Python2 from your machine :) and try again
... into universal/aminoacids.rtp
You can also add them to a separate file (phospholipids, for example) if you prefer.
Hello hello,
Please note that vermouth does not support running on python2, and py2 is EOL. Please upgrade to py3.
You indeed need to add new molecules to 1) universal, 2) target ff (martini3001 in this case), and 3) the mapping between them. Since you added your new files to the py2 folder (rather than py3) it's probably not the folder the code is looking in. So please purge Python2 from your machine :) and try again
... into universal/aminoacids.rtp
You can also add them to a separate file (phospholipids, for example) if you prefer.
Thanks for the prompt response before; I have updated my local python to 3.6 now and martinize2 is running correctly off that. I am running into another issue which I have spent too long trying to debug alone...
With the input command: python3.6 martinize2.py -f input_file.pdb -x output_cg.pdb -ff-dir ff/ -map-dir maps/ -from universal -ff martini3001 -vv
I get the following error message:
Traceback (most recent call last): File "martinize2.py", line 797, in entry() File "martinize2.py", line 545, in entry known_force_fields) File "/home/eddie/.local/lib/python3.6/site-packages/vermouth/map_input.py", line 427, in read_mapping_directory new_mappings = read_backmapping_file(infile, force_fields) File "/home/eddie/.local/lib/python3.6/site-packages/vermouth/map_input.py", line 107, in read_backmapping_file name_to_index[from_ff][name] = _block_names_to_idxs(from_block) File "/home/eddie/.local/lib/python3.6/site-packages/vermouth/map_input.py", line 125, in _block_names_to_idxs return {block.nodes[idx]['atomname']: idx for idx in block.nodes} File "/home/eddie/.local/lib/python3.6/site-packages/vermouth/map_input.py", line 125, in return {block.nodes[idx]['atomname']: idx for idx in block.nodes} KeyError: 'atomname'
ff/ is a local directory which contains a subdirectory force_fields/ and then all the appropriate force_fields for martinize2.py. In the universal force field I have added in a new lipids.rtp (to reorganise as per your suggestion, good future proofing...) containing my new info for the input charmm36 lipids. maps/ contains a subdirectory mappings/ which contains all the *.charmm36.map files.
I have the atom names consistent between the universal force_field, the mapping files and the martini3001 phospholipids itp file. With the -vv flag I can see the following: Level 5 - inconsistent-data - vermouth.map_input - Can't find atom O1 in block CDL2 in force field universal Level 5 - inconsistent-data - vermouth.map_input - Can't find atom OA2 in block CDL2 in force field universal Level 5 - inconsistent-data - vermouth.map_input - Can't find atom PA1 in block CDL2 in force field universal Level 5 - inconsistent-data - vermouth.map_input - Can't find atom OA3 in block CDL2 in force field universal Level 5 - inconsistent-data - vermouth.map_input - Can't find atom OA4 in block CDL2 in force field universal Level 5 - inconsistent-data - vermouth.map_input - Can't find atom OA5 in block CDL2 in force field universal .... With corresponding lines for many of the other lipid atoms (omitted as I fear this may be a long post already). Any advice would be greatly appreciated once again!
The KeyError: 'atomname'
means you have an atom somewhere without atomname, which is not supposed to happen. Could you double check your lipids.rtp? Especially make sure all bonds you specify refer to existing/defined atoms. Feel free to post it here as well. Let's take the CDL2 lipid/block as example. Could you also post the mapping you made?
Many thanks once again Peter; I am using the -ignh flags so despite some badly labelled hydrogens, and maybe missing H-C bonds, I don't think this should be causing this issue. My CDL2 (cardiolipid 2+) block in lipids.rtp is:
[ CDL2 ]
[ atoms ]
CB2 CTL2 -0.080 0
HG31 HAL2 0.090 1
HG32 HAL2 0.090 2
PB2 PL 1.500 3
OB3 O2L -0.780 4
OB4 O2L -0.780 5
OB2 OSLP -0.570 6
OB5 OSLP -0.570 7
CB3 CTL2 -0.080 8
H31J HAL2 0.090 9
H31K HAL2 0.090 10
C1 CTL1 0.140 11
HG22 HAL1 0.090 12
O1 OHL -0.650 13
HO12 HOL 0.420 14
CA2 CTL2 -0.080 15
HG11 HAL2 0.090 16
HG12 HAL2 0.090 17
PA1 PL 1.500 18
OA3 O2L -0.780 19
OA4 O2L -0.780 20
OA2 OSLP -0.570 21
OA5 OSLP -0.570 22
CA3 CTL2 -0.080 23
H11J HAL2 0.090 24
H11K HAL2 0.090 25
CA4 CTL1 0.170 26
H12J HAL1 0.090 27
OA6 OSL -0.490 28
CA5 CL 0.900 29
OA7 OBL -0.630 30
C11 CTL2 -0.220 31
H2A HAL2 0.090 32
H2B HAL2 0.090 33
CA6 CTL2 0.080 34
H13J HAL2 0.090 35
H13K HAL2 0.090 36
OA8 OSL -0.490 37
CA7 CL 0.900 38
OA9 OBL -0.630 39
C32 CTL2 -0.220 40
H2D HAL2 0.090 41
H2E HAL2 0.090 42
CB4 CTL1 0.170 43
H32J HAL1 0.090 44
OB6 OSL -0.490 45
CB5 CL 0.900 46
OB7 OBL -0.630 47
C51 CTL2 -0.220 48
H2R HAL2 0.090 49
H2S HAL2 0.090 50
CB6 CTL2 0.080 51
H33J HAL2 0.090 52
H33K HAL2 0.090 53
OB8 OSL -0.490 54
CB7 CL 0.900 55
OB9 OBL -0.630 56
C71 CTL2 -0.220 57
H2X HAL2 0.090 58
H2Y HAL2 0.090 59
C12 CTL2 -0.180 60
H3A HAL2 0.090 61
H3B HAL2 0.090 62
C13 CTL2 -0.180 63
H4A HAL2 0.090 64
H4B HAL2 0.090 65
C14 CTL2 -0.180 66
H5A HAL2 0.090 67
H5B HAL2 0.090 68
C15 CTL2 -0.180 69
H6A HAL2 0.090 70
H6B HAL2 0.090 71
C16 CTL2 -0.180 72
H7A HAL2 0.090 73
H7B HAL2 0.090 74
C17 CTL2 -0.180 75
H8A HAL2 0.090 76
H8B HAL2 0.090 77
C18 CTL2 -0.180 78
H9A HAL2 0.090 79
H9B HAL2 0.090 80
C19 CTL2 -0.180 81
H10A HAL2 0.090 82
H10B HAL2 0.090 83
C20 CTL2 -0.180 84
H11A HAL2 0.090 85
H11B HAL2 0.090 86
C21 CTL2 -0.180 87
H12A HAL2 0.090 88
H12B HAL2 0.090 89
C22 CTL2 -0.180 90
H13A HAL2 0.090 91
H13B HAL2 0.090 92
C23 CTL2 -0.180 93
H14A HAL2 0.090 94
H14B HAL2 0.090 95
C24 CTL3 -0.270 96
H15A HAL3 0.090 97
H15B HAL3 0.090 98
H15C HAL3 0.090 99
C32 CTL2 -0.180 100
H3D HAL2 0.090 101
H3E HAL2 0.090 102
C33 CTL2 -0.180 103
H4D HAL2 0.090 104
H4E HAL2 0.090 105
C34 CTL2 -0.180 106
H5D HAL2 0.090 107
H5E HAL2 0.090 108
C35 CTL2 -0.180 109
H6D HAL2 0.090 110
H6E HAL2 0.090 111
C36 CTL2 -0.180 112
H7D HAL2 0.090 113
H7E HAL2 0.090 114
C37 CTL2 -0.180 115
H8D HAL2 0.090 116
H8E HAL2 0.090 117
C38 CTL2 -0.180 118
H9D HAL2 0.090 119
H9E HAL2 0.090 120
C39 CTL2 -0.180 121
H10D HAL2 0.090 122
H10E HAL2 0.090 123
C40 CTL2 -0.180 124
H11D HAL2 0.090 125
H11E HAL2 0.090 126
C41 CTL2 -0.180 127
H12D HAL2 0.090 128
H12E HAL2 0.090 129
C42 CTL2 -0.180 130
H13D HAL2 0.090 131
H13E HAL2 0.090 132
C43 CTL3 -0.270 133
H14D HAL3 0.090 134
H14E HAL3 0.090 135
H14F HAL3 0.090 136
C52 CTL2 -0.180 137
H3R HAL2 0.090 138
H3S HAL2 0.090 139
C53 CTL2 -0.180 140
H4R HAL2 0.090 141
H4S HAL2 0.090 142
C54 CTL2 -0.180 143
H5R HAL2 0.090 144
H5S HAL2 0.090 145
C55 CTL2 -0.180 146
H6R HAL2 0.090 147
H6S HAL2 0.090 148
C56 CTL2 -0.180 149
H7R HAL2 0.090 150
H7S HAL2 0.090 151
C57 CTL2 -0.180 152
H8R HAL2 0.090 153
H8S HAL2 0.090 154
C58 CTL3 -0.270 155
H9R HAL3 0.090 156
H9S HAL3 0.090 157
H9T HAL3 0.090 158
C72 CTL2 -0.180 159
H3X HAL2 0.090 160
H3Y HAL2 0.090 161
C73 CTL2 -0.180 162
H4X HAL2 0.090 163
H4Y HAL2 0.090 164
C74 CTL2 -0.180 165
H5X HAL2 0.090 166
H5Y HAL2 0.090 167
C75 CTL2 -0.180 168
H6X HAL2 0.090 169
H6Y HAL2 0.090 170
C76 CTL2 -0.180 171
H7X HAL2 0.090 172
H7Y HAL2 0.090 173
C77 CTL2 -0.180 174
H8X HAL2 0.090 175
H8Y HAL2 0.090 176
C78 CTL2 -0.180 177
H9X HAL2 0.090 178
H9Y HAL2 0.090 179
C79 CTL2 -0.180 180
H10X HAL2 0.090 181
H10Y HAL2 0.090 182
C80 CTL2 -0.180 183
H11X HAL2 0.090 184
H11Y HAL2 0.090 185
C81 CTL2 -0.180 186
H12X HAL2 0.090 187
H12Y HAL2 0.090 188
C82 CTL2 -0.180 189
H13X HAL2 0.090 190
H13Y HAL2 0.090 191
C83 CTL2 -0.180 192
H14X HAL3 0.090 193
H14Y HAL3 0.090 194
H14Z HAL3 0.090 195
C84 CTL3 -0.270 196
H15X HAL3 0.090 197
H15Y HAL3 0.090 198
H15Z HAL3 0.090 199
[ bonds ]
C31 HG31
C31 HG32
CB2 OB2
C1 CB2
PB2 OB3
PB2 OB4
PB2 OB2
PB2 OB5
OB5 CB3
CB3 H31J
CB3 H31K
CB3 CB4
C1 HG22
C1 OG12
CA2 C1
O1 HO12
CA2 HG11
CA2 HG12
CA2 OA2
PA1 OA3
PA1 OA4
PA1 OA2
PA1 OA5
OA5 CA3
CA3 H11J
CA3 H11K
CA3 CA4
CA4 H12J
CA4 OA6
CA4 CA6
OA6 CA5
CA5 OA7
CA5 C11
C11 H2A
C11 H2B
C11 C12
CA6 H13J
CA6 H13K
CA6 OA8
OA8 CA7
CA7 OA9
CA7 C31
C31 H2D
C31 H2E
C31 C32
CB4 H32J
CB4 OB6
CB4 CB6
OB6 CB5
CB5 OB7
CB5 C51
C51 H2R
C51 H2S
C51 C52
CB6 H33J
CB6 H33K
CB6 OB8
OB8 CB7
CB7 OB9
CB7 C71
C71 H2X
C71 H2Y
C71 C72
C12 H3A
C12 H3B
C12 C13
C13 H4A
C13 H4B
C13 C14
C14 H5A
C14 H5B
C14 C15
C15 H6A
C15 H6B
C15 C16
C16 H7A
C16 H7B
C16 C17
C17 H8A
C17 H8B
C17 C18
C18 H9A
C18 H9B
C18 C19
C19 H10A
C19 H10B
C19 C20
C20 H11A
C20 H11B
C20 C21
C21 H12A
C21 H12B
C21 C22
C22 H13A
C22 H13B
C22 C23
C23 H14A
C23 H14B
C23 C24
C32 H3D
C32 H3E
C32 C33
C33 H4D
C33 H4E
C33 C34
C34 H5D
C34 H5E
C34 C35
C35 H6D
C35 H6E
C35 C36
C36 H7D
C36 H7E
C36 C37
C37 H8D
C37 H8E
C37 C38
C38 H9D
C38 H9E
C38 C39
C39 H10D
C39 H10E
C39 C40
C40 H11D
C40 H11E
C40 C41
C41 H12D
C41 H12E
C41 C42
C42 H13D
C42 H13E
C43 C43
C43 H14D
C43 H14E
C43 H14F
C52 H3R
C52 H3S
C52 C53
C53 H4R
C53 H4S
C53 C54
C54 H5R
C54 H5S
C54 C55
C55 H6R
C55 H6S
C55 C56
C56 H7R
C56 H7S
C56 C57
C57 H8R
C57 H8S
C57 C58
C58 H9R
C58 H9S
C58 H9T
C72 H3X
C72 H3Y
C72 C73
C73 H4X
C73 H4Y
C73 C74
C74 H5X
C74 H5Y
C74 C75
C75 H6X
C75 H6Y
C75 C76
C76 H7X
C76 H7Y
C76 C77
C77 H8X
C77 H8Y
C77 C78
C78 H9X
C78 H9Y
C78 C79
C79 H10X
C79 H10Y
C79 C80
C80 H11X
C80 H11Y
C80 CD81
C81 H12X
C81 H12Y
C81 CD82
C82 H13X
C82 H13Y
C82 CD83
C83 H14X
C83 H14Y
C83 C84
C84 H15X
C84 H15Y
C84 H15Z
My cdl2.charmm36.map file looks like this:
[ molecule ]
CDL2
[ from ]
universal
[ to ]
martini3001
[ martini ]
GL0 PO41 GL11 GL12 C1A1 C2A1 D3A1 C4A1 C5A1 C1B1 C2B1 D3B1 CDB1 C5B1 PO42 GL21 GL22 C1A2 C2A2 D3A2 C4A2 C5A2 C1B2 C2B2 D3B2 C4B2 C5B2
[ mapping ]
charmm36
[ atoms ]
1 C1 GL0
2 O1 GL0
3 CA2 GL0
4 OA2 PO41
5 PA1 PO41
6 OA3 PO41
7 OA4 PO41
8 OA5 PO41
9 CA3 PO41
10 CA4 GL11
11 OA6 GL11
12 CA5 GL11
13 OA7 GL11
14 C11 C1A1
15 C12 C1A1
16 C13 C1A1
17 C14 C1A1
18 C15 C2A1
19 C16 C2A1
20 C17 C2A1
21 C18 C2A1
22 C19 D3A1
23 C20 D3A1
24 C21 C4A1
25 C22 C4A1
26 C23 C5A1
27 C24 C5A1
28 CA6 GL12
29 OA8 GL12
30 CA7 GL12
31 OA9 GL12
32 C31 C1B1
33 C32 C1B1
34 C33 C2B1
35 C34 C2B1
36 C35 C2B1
37 C36 D3B1
38 C37 D3B1
39 C38 C4B1
40 C39 C4B1
41 C40 C4B1
42 C41 C5B1
43 C42 C5B1
44 C43 C5B1
45 CB2 GL0
46 OB2 PO42
47 PB2 PO42
48 OB3 PO42
49 OB4 PO42
50 OB5 PO42
51 CB3 PO42
52 CB4 GL21
53 OB6 GL21
54 CB5 GL21
55 OB7 GL21
56 C51 C1A2
57 C52 C1A2
58 C53 C2A2
59 C54 C2A2
60 C55 D3A2
61 C56 C4A2
62 C57 C4A2
63 C58 C5A2
64 CB6 GL22
65 OB8 GL22
66 CB7 GL22
67 OB9 GL22
68 C71 C1B2
69 C72 C1B2
70 C73 C1B2
71 C74 C2B2
72 C75 C2B2
73 C76 C2B2
74 C77 D3B2
75 C78 D3B2
76 C79 C4B2
77 C80 C4B2
78 C81 C4B2
79 C82 C5B2
80 C83 C5B2
81 C84 C5B2
There are two other lipids but I don't get any 'Level 5 - inconsistent data ...' messages about their atoms with them, so I think the issue is just with CDL2.
A quick script gave me the following:
Duplicate name C32
name C31 not known (C31-HG31)
name C31 not known (C31-HG32)
name OG12 not known (C1-OG12)
name C31 not known (CA7-C31)
name C31 not known (C31-H2D)
name C31 not known (C31-H2E)
name C31 not known (C31-C32)
name CD81 not known (C80-CD81)
name CD82 not known (C81-CD82)
name CD83 not known (C82-CD83)
Good luck :)
Thank you for the good luck! That was exactly the issue; I noticed that the script wasn't seeming to pick up the files located in my working directory too well no matter how I tried to organise them and used the -ff-dir and -map-dir flags, so I have switched to working from the local files saved in my python section which works a lot better. I have unfortunately run into a new problem which I am struggling to make headway with: it seems that the block is being picked up as a NoneType object and so it's not playing nice with the rtp.py script (error below). I think perhaps this is do with the formatting of my lipids.rtp file but to my untrained eye, I can't see any differences between that and the originally provided aminoacids.rtp.
python3.6 martinize2.py -f CDL.pdb -x input_charmm_cg.pdb -from universal -ff martini3001 -vv -ignh Traceback (most recent call last): File "martinize2.py", line 797, in
entry() File "martinize2.py", line 542, in entry Path(DATA_PATH) / 'force_fields' File "/home/eddie/.local/lib/python3.6/site-packages/vermouth/forcefield.py", line 171, in find_force_fields force_fields[name] = ForceField(path) File "/home/eddie/.local/lib/python3.6/site-packages/vermouth/forcefield.py", line 72, in init self.read_from(directory) File "/home/eddie/.local/lib/python3.6/site-packages/vermouth/forcefield.py", line 91, in read_from FORCE_FIELD_PARSERS[extension](infile, self) File "/home/eddie/.local/lib/python3.6/site-packages/vermouth/gmx/rtp.py", line 515, in read_rtp _complete_block(pre_block, bondedtypes) File "/home/eddie/.local/lib/python3.6/site-packages/vermouth/gmx/rtp.py", line 265, in _complete_block if _keep_dihedral(center, block, bondedtypes): File "/home/eddie/.local/lib/python3.6/site-packages/vermouth/gmx/rtp.py", line 241, in _keep_dihedral if (not bondedtypes.all_dihedrals) and block.has_dihedral_around(center): AttributeError: 'NoneType' object has no attribute 'all_dihedrals'
I used a small peptide (just glycine and alanine) to test this, and using that file as an input, I got the exact same error. Any advice would once again be appreciated!
The error message is super obscure, but you're missing a [ bondedtypes ]
section at the beginning of your rtp file:
From universal/aminoacids.rtp:
[ bondedtypes ]
; Column 1 : default bondtype
; Column 2 : default angletype
; Column 3 : default proper dihedraltype
; Column 4 : default improper dihedraltype
; Column 5 : This controls the generation of dihedrals from the bonding.
; All possible dihedrals are generated automatically. A value of
; 1 here means that all these are retained. A value of
; 0 here requires generated dihedrals be removed if
; * there are any dihedrals on the same central atoms
; specified in the residue topology, or
; * there are other identical generated dihedrals
; sharing the same central atoms, or
; * there are other generated dihedrals sharing the
; same central bond that have fewer hydrogen atoms
; Column 6 : number of neighbors to exclude from non-bonded interactions
; Column 7 : 1 = generate 1,4 interactions between pairs of hydrogen atoms
; 0 = do not generate such
; Column 8 : 1 = remove proper dihedrals if found centered on the same
; bond as an improper dihedral
; 0 = do not generate such
; bondtype angletype dihedraltype impropertype all_dih nrexcl HH14 bRemoveDih
1 5 9 2 1 3 1 0
Thanks for all the help, Peter! Hopefully fewer mistakes with martini in my future :)
Hi,
I have been attempting to coarse grain a membrane using martinize2; I have three lipids which I have charmm36 definitions for and an input .pdb file which contains the membrane. I have attempted to add in these new molecules to the force fields for martinize2 but I have been going around in circles.
In the /.local/lib/python2.7/site-packages/vermouth/data/force_fields folders, I have added in new definitions for these molecules into universal/aminoacids.rtp, and also in martini3001/martini_v3.0.0_phospholipids.itp and the same new definitions in martini3001/aminoacids.ff also as a safety measure... I have added in some LIPID.charmm36.map files whose format I believe is correct. I have these in the local directory I am running the script from and also in /.local/lib/python2.7/site-packages/vermouth/data/mappings .
I am using martinize2 in Spyder with the following flags: martinize2.py -f C:/Users/emfla/Desktop/coarsegrain/epidermicin/gramposmemb/charmm-gui-3431070502/gromacs/martini3.0/smaller_input.pdb -x input_charmm_cg.pdb -from universal -ff martini3001 -v -maxwarn 1000 -write-graph graph_out.pdb -write-repair repair_out.pdb
The write-graph output contains just the pdb file with the same molecules, although some extra bonds are unnecessarily added due to distance. The write-repair output gives me an empty file. My error message is:
WARNING - unknown-residue - vermouth.processors.repair_graph - Cannot recognize residue 'POPG' in molecule 1. Deleting the molecule.
I have used the default version of martini POPG so I am unsure why it is not recognising it. Presumably I need to add in its definition to somewhere else that I have neglected but the documentation isn't clear on where that is. Any assistance would be greatly appreciated; let me know if there's any other info needed or perhaps some files that I can provide.
If I use -list-blocks I get the following: The following Blocks are known to force field universal: ALA, ARG, ASN, ASP, ASPP, CYS, CYS2, GLN, GLU, GLUP, GLY, HSD, HSE, HSP, HIS, ILE, LEU, LYS, LSN, MET, PHE, PRO, SER, THR, TRP, TYR, VAL, ALAD, HEME, HEO2, O2, CO, HOH, TIP3, TP3M, HO4, SOD, MG, POT, CES, CAL, CLA, ZN2, ACE, CT3 The following Modifications are known to force field universal: C-ter, COOH-ter, N-ter, NH2-ter, GLU-H, HSD, HSE, HSP, ASP0
The following Blocks are known to force field martini3001: GLY, ALA, CYS, VAL, LEU, ILE, MET, PRO, HYP, ASN, GLN, ASP, GLU, THR, SER, LYS, ARG, HIS, HIH, PHE, TYR, TRP The following Modifications are known to force field martini3001: C-ter, N-ter, COOH-ter, NH2-ter
So neither martini3001 or universal seem to have POPG & two other custom lipids in their list of blocks...