Repository: marrink-lab/polyply_1.0 (language: python)

Issue:
Log entries
With vermouth v0.9.0 we can now have log-entries in ff-files. This implements such entries to polyply gen_params. One nice thing to use these for is to raise a warning whenever people are not applying termini to polymers or to print ff parameters in case they are not part of the default force-field. 

@pckroon do you have any idea why in the current setup info messages wouldn't be printed? Warnings and Errors are info. 


Discussion / hints:

Fix patch:
diff --git a/LIBRARY.md b/LIBRARY.md
index 925a0748..9501df49 100644
--- a/LIBRARY.md
+++ b/LIBRARY.md
@@ -25,4 +25,4 @@
 |Dextran                        |DEX                      |                                                                       |[martini3](polyply/data/martini3/dextran.martini3.ff) |
 |DNA nucleobases                |Dx, Tx5, Dx3 w/ x=T,G,A,C|[parmbsc1](polyply/data/parmbsc1/dna_final.ff)                         |[martini2](polyply/data/martini2/DNA_M2.ff)           |
 |Aminoacids                     |3 letter code            |                                                                       |[martini3](polyply/data/martini3/aminoacids.ff)       |
-
+|Polydimethylsiloxane  |PDMS                   |                                                                       |[martini3](polyply/data/martini3/PDMS.martini3.ff)
diff --git a/polyply/data/martini3/PDMS.martini3.ff b/polyply/data/martini3/PDMS.martini3.ff
new file mode 100644
index 00000000..06bc0408
--- /dev/null
+++ b/polyply/data/martini3/PDMS.martini3.ff
@@ -0,0 +1,87 @@
+[ citations ]
+Martini3
+polyply
+M3_PDMS
+;
+[ moleculetype ]
+; molname        nrexcl
+PDMS             1
+;
+[ atoms ]
+;  id  type  resnr  residue    atom  cgnr    charge     mass
+    1    DMS      1     PDMS    PDMS   1      0.00000     72.00
+;
+[ link ]
+resname "PDMS"
+[ bonds ]
+;   i     j   funct   length   force.c.
+  PDMS   +PDMS     1    0.448  11500           ; 2
+;
+[ link ]
+resname "PDMS"
+[ angles ]
+;   i     j     k   funct     angle   force.c.
+  PDMS   +PDMS   ++PDMS       1     86     45.89           ; 2
+;
+[ link ]
+resname "PDMS"
+[ dihedrals ]
+;   i     j     k     l   funct     dihedral   force.c.   mult.
+  PDMS   +PDMS   ++PDMS   +++PDMS       1         1.18    1.4       1     ; 2
+;
+[ moleculetype ]
+PDMSter  1
+[ atoms ]
+  1    DMS      1     PDMSter     END   1      0.00000     72.00
+[ info ]
+Parameters for this model are custom and available for download at: https://github.com/marrink-lab/martini-forcefields/blob/main/martini_forcefields/regular/v3.0.0/gmx_files_contributed/DMS_martini3_v1.itp
+
+[ link ]
+resname "PDMSter|PDMS"
+[ bonds ]
+  END    +PDMS       1    0.446  11000     {"group": "END-PDMS"}
+
+[ link ]
+resname "PDMS|PDMSter"
+[ bonds ]
+  PDMS    +END       1    0.446  11000     {"group": "PDMS-END"}  
+
+
+[ link ]
+resname "PDMSter|PDMS"
+[ angles ]
+END   +PDMS   ++PDMS   1     87     78  {"group": "END-PDMS"} 
+
+[ link ]
+resname "PDMS|PDMSter"
+[ angles ]
+PDMS   +PDMS   ++END   1     87     78  {"group": "PDMS-END"} 
+
+
+[ link ]
+resname "PDMSter|PDMS"
+[ dihedrals ]
+END  +PDMS  ++PDMS  +++PDMS  1    1.85    1.2    1 {"group": "END-PDMS"}
+
+[ link ]
+resname "PDMS|PDMSter"
+[ dihedrals ]
+PDMS  +PDMS  ++PDMS  +++END  1    1.85    1.2    1 {"group": "PDMS-END"}
+
+[ link ]
+[ atoms ]
+PDMS {"resname": "PDMS"}
+[ warning ]
+You should patch PDMS with a terminal residue. Use -seq PDMSter:1 PDMS:4 PDMSter:1
+[ non-edges ]
+PDMS +PDMS
+PDMS +END
+
+[ link ]
+[ atoms ]
+PDMS {"resname": "PDMS"}
+[ warning ]
+You should patch PDMS with a terminal residue. Use -seq PDMSter:1 PDMS:4 PDMSter:1
+[ non-edges ]
+PDMS -PDMS
+PDMS -END
diff --git a/polyply/data/martini3/citations.bib b/polyply/data/martini3/citations.bib
index 669e9911..1b0c8061 100644
--- a/polyply/data/martini3/citations.bib
+++ b/polyply/data/martini3/citations.bib
@@ -46,4 +46,13 @@ @article{M3_sugars
   journal={JCTC},
   doi={10.1021/acs.jctc.2c00757},
   url={https://doi.org/10.1021/acs.jctc.2c00757}}
-
+@article{M3_PDMS,
+  title={Development of a transferable coarse-grained model of polydimethylsiloxane},
+  author={Cambiaso, Sonia and Rasera, Fabio and Rossi, Giulia and Bochicchio, Davide},
+  journal={Soft Matter},
+  volume={18},
+  number={40},
+  pages={7887--7896},
+  year={2022},
+  publisher={Royal Society of Chemistry}
+}


Test patch:
diff --git a/polyply/tests/test_data/library_tests/martini3/PDMS/polyply/PDMS.itp b/polyply/tests/test_data/library_tests/martini3/PDMS/polyply/PDMS.itp
new file mode 100644
index 00000000..35145fe7
--- /dev/null
+++ b/polyply/tests/test_data/library_tests/martini3/PDMS/polyply/PDMS.itp
@@ -0,0 +1,224 @@
+; polyply-itp
+
+; Please cite the following papers:
+; Souza, P C T; Alessandri, R; Barnoud, J; Thallmair, S; Faustino, I; Grünewald, F; Patmanidis, I; Abdizadeh, H; Bruininks, B M H; Wassenaar, T A; Kroon, P C; Melcr, J; Nieto, V; Corradi, V; Khan, H M; Domański, J; Javanainen, M; Martinez-Seara, H; Reuter, N; Best, R B; Vattulainen, I; Monticelli, L; Periole, X; Tieleman, D P; de Vries, A H; Marrink, S J;  Nature Methods 2021; 10.1038/s41592-021-01098-3
+; Grunewald, F; Alessandri, R; Kroon, P C; Monticelli, L; Souza, P C; Marrink, S J;  Nature Communications 2022; 10.1038/s41467-021-27627-4
+; Cambiaso, S; Rasera, F; Rossi, G; Bochicchio, D;  Soft Matter 2022
+
+[ moleculetype ]
+PDMS 1
+
+[ atoms ]
+ 1 DMS  1 PDMSter  END   1 0.0 72.0
+ 2 DMS  2 PDMS PDMS  2 0.0 72.0
+ 3 DMS  3 PDMS PDMS  3 0.0 72.0
+ 4 DMS  4 PDMS PDMS  4 0.0 72.0
+ 5 DMS  5 PDMS PDMS  5 0.0 72.0
+ 6 DMS  6 PDMS PDMS  6 0.0 72.0
+ 7 DMS  7 PDMS PDMS  7 0.0 72.0
+ 8 DMS  8 PDMS PDMS  8 0.0 72.0
+ 9 DMS  9 PDMS PDMS  9 0.0 72.0
+10 DMS 10 PDMS PDMS 10 0.0 72.0
+11 DMS 11 PDMS PDMS 11 0.0 72.0
+12 DMS 12 PDMS PDMS 12 0.0 72.0
+13 DMS 13 PDMS PDMS 13 0.0 72.0
+14 DMS 14 PDMS PDMS 14 0.0 72.0
+15 DMS 15 PDMS PDMS 15 0.0 72.0
+16 DMS 16 PDMS PDMS 16 0.0 72.0
+17 DMS 17 PDMS PDMS 17 0.0 72.0
+18 DMS 18 PDMS PDMS 18 0.0 72.0
+19 DMS 19 PDMS PDMS 19 0.0 72.0
+20 DMS 20 PDMS PDMS 20 0.0 72.0
+21 DMS 21 PDMS PDMS 21 0.0 72.0
+22 DMS 22 PDMS PDMS 22 0.0 72.0
+23 DMS 23 PDMS PDMS 23 0.0 72.0
+24 DMS 24 PDMS PDMS 24 0.0 72.0
+25 DMS 25 PDMS PDMS 25 0.0 72.0
+26 DMS 26 PDMS PDMS 26 0.0 72.0
+27 DMS 27 PDMS PDMS 27 0.0 72.0
+28 DMS 28 PDMS PDMS 28 0.0 72.0
+29 DMS 29 PDMS PDMS 29 0.0 72.0
+30 DMS 30 PDMS PDMS 30 0.0 72.0
+31 DMS 31 PDMS PDMS 31 0.0 72.0
+32 DMS 32 PDMS PDMS 32 0.0 72.0
+33 DMS 33 PDMS PDMS 33 0.0 72.0
+34 DMS 34 PDMS PDMS 34 0.0 72.0
+35 DMS 35 PDMS PDMS 35 0.0 72.0
+36 DMS 36 PDMS PDMS 36 0.0 72.0
+37 DMS 37 PDMS PDMS 37 0.0 72.0
+38 DMS 38 PDMS PDMS 38 0.0 72.0
+39 DMS 39 PDMS PDMS 39 0.0 72.0
+40 DMS 40 PDMS PDMS 40 0.0 72.0
+41 DMS 41 PDMS PDMS 41 0.0 72.0
+42 DMS 42 PDMS PDMS 42 0.0 72.0
+43 DMS 43 PDMS PDMS 43 0.0 72.0
+44 DMS 44 PDMS PDMS 44 0.0 72.0
+45 DMS 45 PDMS PDMS 45 0.0 72.0
+46 DMS 46 PDMS PDMS 46 0.0 72.0
+47 DMS 47 PDMS PDMS 47 0.0 72.0
+48 DMS 48 PDMS PDMS 48 0.0 72.0
+49 DMS 49 PDMS PDMS 49 0.0 72.0
+50 DMS 50 PDMSter END  50 0.0 72.0
+
+[ bonds ]
+ 2  3 1 0.448 11500
+ 3  4 1 0.448 11500
+ 4  5 1 0.448 11500
+ 5  6 1 0.448 11500
+ 6  7 1 0.448 11500
+ 7  8 1 0.448 11500
+ 8  9 1 0.448 11500
+ 9 10 1 0.448 11500
+10 11 1 0.448 11500
+11 12 1 0.448 11500
+12 13 1 0.448 11500
+13 14 1 0.448 11500
+14 15 1 0.448 11500
+15 16 1 0.448 11500
+16 17 1 0.448 11500
+17 18 1 0.448 11500
+18 19 1 0.448 11500
+19 20 1 0.448 11500
+20 21 1 0.448 11500
+21 22 1 0.448 11500
+22 23 1 0.448 11500
+23 24 1 0.448 11500
+24 25 1 0.448 11500
+25 26 1 0.448 11500
+26 27 1 0.448 11500
+27 28 1 0.448 11500
+28 29 1 0.448 11500
+29 30 1 0.448 11500
+30 31 1 0.448 11500
+31 32 1 0.448 11500
+32 33 1 0.448 11500
+33 34 1 0.448 11500
+34 35 1 0.448 11500
+35 36 1 0.448 11500
+36 37 1 0.448 11500
+37 38 1 0.448 11500
+38 39 1 0.448 11500
+39 40 1 0.448 11500
+40 41 1 0.448 11500
+41 42 1 0.448 11500
+42 43 1 0.448 11500
+43 44 1 0.448 11500
+44 45 1 0.448 11500
+45 46 1 0.448 11500
+46 47 1 0.448 11500
+47 48 1 0.448 11500
+48 49 1 0.448 11500
+
+; END-PDMS
+ 1  2 1 0.446 11000
+
+; PDMS-END
+49 50 1 0.446 11000
+
+[ angles ]
+ 2  3  4 1 86 45.89
+ 3  4  5 1 86 45.89
+ 4  5  6 1 86 45.89
+ 5  6  7 1 86 45.89
+ 6  7  8 1 86 45.89
+ 7  8  9 1 86 45.89
+ 8  9 10 1 86 45.89
+ 9 10 11 1 86 45.89
+10 11 12 1 86 45.89
+11 12 13 1 86 45.89
+12 13 14 1 86 45.89
+13 14 15 1 86 45.89
+14 15 16 1 86 45.89
+15 16 17 1 86 45.89
+16 17 18 1 86 45.89
+17 18 19 1 86 45.89
+18 19 20 1 86 45.89
+19 20 21 1 86 45.89
+20 21 22 1 86 45.89
+21 22 23 1 86 45.89
+22 23 24 1 86 45.89
+23 24 25 1 86 45.89
+24 25 26 1 86 45.89
+25 26 27 1 86 45.89
+26 27 28 1 86 45.89
+27 28 29 1 86 45.89
+28 29 30 1 86 45.89
+29 30 31 1 86 45.89
+30 31 32 1 86 45.89
+31 32 33 1 86 45.89
+32 33 34 1 86 45.89
+33 34 35 1 86 45.89
+34 35 36 1 86 45.89
+35 36 37 1 86 45.89
+36 37 38 1 86 45.89
+37 38 39 1 86 45.89
+38 39 40 1 86 45.89
+39 40 41 1 86 45.89
+40 41 42 1 86 45.89
+41 42 43 1 86 45.89
+42 43 44 1 86 45.89
+43 44 45 1 86 45.89
+44 45 46 1 86 45.89
+45 46 47 1 86 45.89
+46 47 48 1 86 45.89
+47 48 49 1 86 45.89
+
+; END-PDMS
+ 1  2  3 1 87 78
+
+; PDMS-END
+48 49 50 1 87 78
+
+[ dihedrals ]
+ 2  3  4  5 1 1.18 1.4 1
+ 3  4  5  6 1 1.18 1.4 1
+ 4  5  6  7 1 1.18 1.4 1
+ 5  6  7  8 1 1.18 1.4 1
+ 6  7  8  9 1 1.18 1.4 1
+ 7  8  9 10 1 1.18 1.4 1
+ 8  9 10 11 1 1.18 1.4 1
+ 9 10 11 12 1 1.18 1.4 1
+10 11 12 13 1 1.18 1.4 1
+11 12 13 14 1 1.18 1.4 1
+12 13 14 15 1 1.18 1.4 1
+13 14 15 16 1 1.18 1.4 1
+14 15 16 17 1 1.18 1.4 1
+15 16 17 18 1 1.18 1.4 1
+16 17 18 19 1 1.18 1.4 1
+17 18 19 20 1 1.18 1.4 1
+18 19 20 21 1 1.18 1.4 1
+19 20 21 22 1 1.18 1.4 1
+20 21 22 23 1 1.18 1.4 1
+21 22 23 24 1 1.18 1.4 1
+22 23 24 25 1 1.18 1.4 1
+23 24 25 26 1 1.18 1.4 1
+24 25 26 27 1 1.18 1.4 1
+25 26 27 28 1 1.18 1.4 1
+26 27 28 29 1 1.18 1.4 1
+27 28 29 30 1 1.18 1.4 1
+28 29 30 31 1 1.18 1.4 1
+29 30 31 32 1 1.18 1.4 1
+30 31 32 33 1 1.18 1.4 1
+31 32 33 34 1 1.18 1.4 1
+32 33 34 35 1 1.18 1.4 1
+33 34 35 36 1 1.18 1.4 1
+34 35 36 37 1 1.18 1.4 1
+35 36 37 38 1 1.18 1.4 1
+36 37 38 39 1 1.18 1.4 1
+37 38 39 40 1 1.18 1.4 1
+38 39 40 41 1 1.18 1.4 1
+39 40 41 42 1 1.18 1.4 1
+40 41 42 43 1 1.18 1.4 1
+41 42 43 44 1 1.18 1.4 1
+42 43 44 45 1 1.18 1.4 1
+43 44 45 46 1 1.18 1.4 1
+44 45 46 47 1 1.18 1.4 1
+45 46 47 48 1 1.18 1.4 1
+46 47 48 49 1 1.18 1.4 1
+
+; END-PDMS
+ 1  2  3  4 1 1.85 1.2 1
+
+; PDMS-END
+47 48 49 50 1 1.85 1.2 1
+
diff --git a/polyply/tests/test_data/library_tests/martini3/PDMS/polyply/command b/polyply/tests/test_data/library_tests/martini3/PDMS/polyply/command
new file mode 100644
index 00000000..14c15347
--- /dev/null
+++ b/polyply/tests/test_data/library_tests/martini3/PDMS/polyply/command
@@ -0,0 +1,1 @@
+polyply gen_params -lib martini3 -seq PDMSter:1 PDMS:48 PDMSter:1 -o PDMS.itp -name PDMS
diff --git a/polyply/tests/test_lib_files.py b/polyply/tests/test_lib_files.py
index 79afccc5..98d748eb 100644
--- a/polyply/tests/test_lib_files.py
+++ b/polyply/tests/test_lib_files.py
@@ -178,6 +178,7 @@ def _interaction_equal(interaction1, interaction2, inter_type):
      ['2016H66', 'PS'],
      ['gromos53A6', 'P3HT'],
      ['oplsaaLigParGen', 'PEO'],
+     ['martini3', 'PDMS'],
      ['martini3', 'PROT'],
      ['martini3', 'PEO'],
      ['martini3', 'PS'],