marrink-lab / polyply_1.0

Generate input parameters and coordinates for atomistic and coarse-grained simulations of polymers, ssDNA, and carbohydrates
Apache License 2.0
125 stars 22 forks source link

OSError: Couldn't find block with residue name VAL in the library or input file definitions. #273

Closed l454025801 closed 2 years ago

l454025801 commented 2 years ago

I want to connect 4 separate itp files into 1. I used the following command:

polyply gen_seq -f C12.itp VVKK.itp OEG_4.itp ../Z33/Z33_mar3.itp -from_file c:C12 v:VVKK o:O4 z:Z33 -seq c v o z -connects 0:1:0-0 1:2:3-0 2:3:3-0 -o seq.json -name test -label 0:"from_itp":"C12-1"

polyply gen_itp -f C12.itp VVKK.itp OEG_4.itp ../Z33/Z33_mar3.itp link.ff -o Z33_O4 -seqf seq.json -name Z33_O4

It gave the errors:

INFO - step - reading input and library files
INFO - step - reading sequence from file
WARNING - general - Node 0 has no resid. Setting resid to 0 + 1.
WARNING - general - Node 1 has no resid. Setting resid to 1 + 1.
WARNING - general - Node 2 has no resid. Setting resid to 2 + 1.
WARNING - general - Node 3 has no resid. Setting resid to 3 + 1.
WARNING - general - Node 4 has no resid. Setting resid to 4 + 1.
WARNING - general - Node 5 has no resid. Setting resid to 5 + 1.
WARNING - general - Node 6 has no resid. Setting resid to 6 + 1.
WARNING - general - Node 7 has no resid. Setting resid to 7 + 1.
WARNING - general - Node 8 has no resid. Setting resid to 8 + 1.
WARNING - general - Node 9 has no resid. Setting resid to 9 + 1.
WARNING - general - Node 10 has no resid. Setting resid to 10 + 1.
WARNING - general - Node 11 has no resid. Setting resid to 11 + 1.
WARNING - general - Node 12 has no resid. Setting resid to 12 + 1.
WARNING - general - Node 13 has no resid. Setting resid to 13 + 1.
WARNING - general - Node 14 has no resid. Setting resid to 14 + 1.
WARNING - general - Node 15 has no resid. Setting resid to 15 + 1.
WARNING - general - Node 16 has no resid. Setting resid to 16 + 1.
WARNING - general - Node 17 has no resid. Setting resid to 17 + 1.
WARNING - general - Node 18 has no resid. Setting resid to 18 + 1.
WARNING - general - Node 19 has no resid. Setting resid to 19 + 1.
WARNING - general - Node 20 has no resid. Setting resid to 20 + 1.
WARNING - general - Node 21 has no resid. Setting resid to 21 + 1.
WARNING - general - Node 22 has no resid. Setting resid to 22 + 1.
WARNING - general - Node 23 has no resid. Setting resid to 23 + 1.
WARNING - general - Node 24 has no resid. Setting resid to 24 + 1.
WARNING - general - Node 25 has no resid. Setting resid to 25 + 1.
WARNING - general - Node 26 has no resid. Setting resid to 26 + 1.
WARNING - general - Node 27 has no resid. Setting resid to 27 + 1.
WARNING - general - Node 28 has no resid. Setting resid to 28 + 1.
WARNING - general - Node 29 has no resid. Setting resid to 29 + 1.
WARNING - general - Node 30 has no resid. Setting resid to 30 + 1.
WARNING - general - Node 31 has no resid. Setting resid to 31 + 1.
WARNING - general - Node 32 has no resid. Setting resid to 32 + 1.
WARNING - general - Node 33 has no resid. Setting resid to 33 + 1.
WARNING - general - Node 34 has no resid. Setting resid to 34 + 1.
WARNING - general - Node 35 has no resid. Setting resid to 35 + 1.
WARNING - general - Node 36 has no resid. Setting resid to 36 + 1.
WARNING - general - Node 37 has no resid. Setting resid to 37 + 1.
WARNING - general - Node 38 has no resid. Setting resid to 38 + 1.
WARNING - general - Node 39 has no resid. Setting resid to 39 + 1.
WARNING - general - Node 40 has no resid. Setting resid to 40 + 1.
WARNING - general - Node 41 has no resid. Setting resid to 41 + 1.
INFO - step - mapping sequence to molecule
Traceback (most recent call last):
  File "/home/leon/anaconda3/bin/polyply", line 256, in <module>
    main()
  File "/home/leon/anaconda3/bin/polyply", line 252, in main
    args.func(args)
  File "/home/leon/anaconda3/lib/python3.8/site-packages/polyply/src/gen_itp.py", line 79, in gen_params
    meta_molecule = MapToMolecule(force_field).run_molecule(meta_molecule)
  File "/home/leon/anaconda3/lib/python3.8/site-packages/polyply/src/map_to_molecule.py", line 285, in run_molecule
    _assert_blocks_in_FF(self.node_to_block.values(),
  File "/home/leon/anaconda3/lib/python3.8/site-packages/polyply/src/map_to_molecule.py", line 86, in _assert_blocks_in_FF
    raise IOError("Couldn't find block with residue name {name}\n"
OSError: Couldn't find block with residue name VAL
in the library or input file definitions.

Below is the VVKK.itp and the link.ff

[ link ]
[ molmeta ]
by_atom_id true
[ bonds ]
5 5 1 0.41 2000 ; b3
12 15 1 0.39 5000 ; b4
18 19 1 0.39 5000

[ angles ]
4 5 6 2 150 15 ; alpha
12 15 16  2 170 50 ; beta
17 18 19  2 150 15

[ moleculetype ]
VVKK 1

[ atoms ]
 1 Q5   1 VAL BB   1   1
 2 SC3  1 VAL SC1  2 0.0
 3 SP2  2 VAL BB   3 0.0
 4 SC3  2 VAL SC1  4 0.0

{
  "directed": false,
  "multigraph": false,
  "graph": {},
  "nodes": [
    {
      "resname": "C12",
      "seqid": 0,
      "from_itp": "C12",
      "id": 0
    },
    {
      "resname": "VAL",
      "seqid": 1,
      "id": 1
    },
    {
      "resname": "VAL",
      "seqid": 1,
      "id": 2
    },
    {
      "resname": "LYS",
      "seqid": 1,
      "id": 3
    },
    {
      "resname": "LYS",
      "seqid": 1,
      "id": 4
    },
    {
      "resname": "OEG",
      "seqid": 2,
      "id": 5
    },
    {
      "resname": "OEG",
      "seqid": 2,
      "id": 6
    },
    {
      "resname": "OEG",
      "seqid": 2,
      "id": 7
    },
    {
      "resname": "OEG",
      "seqid": 2,
      "id": 8
    },
    {
      "resname": "PHE",
      "seqid": 3,
      "id": 9
    },
    {
      "resname": "ASN",
      "seqid": 3,
      "id": 10
    },
    {
      "resname": "MET",
      "seqid": 3,
      "id": 11
    },
    {
      "resname": "GLN",
      "seqid": 3,
      "id": 12
    },
    {
      "resname": "GLN",
      "seqid": 3,
      "id": 13
    },
    {
      "resname": "GLN",
      "seqid": 3,
      "id": 14
    },
    {
      "resname": "ARG",
      "seqid": 3,
      "id": 15
    },
    {
      "resname": "ARG",
      "seqid": 3,
      "id": 16
    },
    {
      "resname": "PHE",
      "seqid": 3,
      "id": 17
    },
    {
      "resname": "TYR",
      "seqid": 3,
      "id": 18
    },
    {
      "resname": "GLU",
      "seqid": 3,
      "id": 19
    },
    {
      "resname": "ALA",
      "seqid": 3,
      "id": 20
    },
    {
      "resname": "LEU",
      "seqid": 3,
      "id": 21
    },
    {
      "resname": "HIS",
      "seqid": 3,
      "id": 22
    },
    {
      "resname": "ASP",
      "seqid": 3,
      "id": 23
    },
    {
      "resname": "PRO",
      "seqid": 3,
      "id": 24
    },
    {
      "resname": "ASN",
      "seqid": 3,
      "id": 25
    },
    {
      "resname": "LEU",
      "seqid": 3,
      "id": 26
    },
    {
      "resname": "ASN",
      "seqid": 3,
      "id": 27
    },
    {
      "resname": "GLU",
      "seqid": 3,
      "id": 28
    },
    {
      "resname": "GLU",
      "seqid": 3,
      "id": 29
    },
    {
      "resname": "GLN",
      "seqid": 3,
      "id": 30
    },
    {
      "resname": "ARG",
      "seqid": 3,
      "id": 31
    },
    {
      "resname": "ASN",
      "seqid": 3,
      "id": 32
    },
    {
      "resname": "ALA",
      "seqid": 3,
      "id": 33
    },
    {
      "resname": "LYS",
      "seqid": 3,
      "id": 34
    },
    {
      "resname": "ILE",
      "seqid": 3,
      "id": 35
    },
    {
      "resname": "LYS",
      "seqid": 3,
      "id": 36
    },
    {
      "resname": "SER",
      "seqid": 3,
      "id": 37
    },
    {
      "resname": "ILE",
      "seqid": 3,
      "id": 38
    },
    {
      "resname": "ARG",
      "seqid": 3,
      "id": 39
    },
    {
      "resname": "ASP",
      "seqid": 3,
      "id": 40
    },
    {
      "resname": "ASP",
      "seqid": 3,
      "id": 41
    }
  ],
  "links": [
    {
      "source": 0,
      "target": 1
    },
    {
      "source": 1,
      "target": 2
    },
    {
      "source": 2,
      "target": 3
    },
    {
      "source": 3,
      "target": 4
    },
    {
      "source": 4,
      "target": 5
    },
    {
      "source": 5,
      "target": 6
    },
    {
      "source": 6,
      "target": 7
    },
    {
      "source": 7,
      "target": 8
    },
    {
      "source": 8,
      "target": 9
    },
    {
      "source": 9,
      "target": 12
    },
    {
      "source": 9,
      "target": 13
    },
    {
      "source": 9,
      "target": 14
    },
    {
      "source": 9,
      "target": 10
    },
    {
      "source": 10,
      "target": 13
    },
    {
      "source": 10,
      "target": 14
    },
    {
      "source": 10,
      "target": 15
    },
    {
      "source": 10,
      "target": 11
    },
    {
      "source": 11,
      "target": 14
    },
    {
      "source": 11,
      "target": 15
    },
    {
      "source": 11,
      "target": 16
    },
    {
      "source": 11,
      "target": 12
    },
    {
      "source": 12,
      "target": 15
    },
    {
      "source": 12,
      "target": 16
    },
    {
      "source": 12,
      "target": 17
    },
    {
      "source": 12,
      "target": 13
    },
    {
      "source": 13,
      "target": 16
    },
    {
      "source": 13,
      "target": 17
    },
    {
      "source": 13,
      "target": 18
    },
    {
      "source": 13,
      "target": 38
    },
    {
      "source": 13,
      "target": 39
    },
    {
      "source": 13,
      "target": 41
    },
    {
      "source": 13,
      "target": 14
    },
    {
      "source": 14,
      "target": 17
    },
    {
      "source": 14,
      "target": 18
    },
    {
      "source": 14,
      "target": 19
    },
    {
      "source": 14,
      "target": 38
    },
    {
      "source": 14,
      "target": 39
    },
    {
      "source": 14,
      "target": 15
    },
    {
      "source": 15,
      "target": 18
    },
    {
      "source": 15,
      "target": 19
    },
    {
      "source": 15,
      "target": 20
    },
    {
      "source": 15,
      "target": 16
    },
    {
      "source": 16,
      "target": 19
    },
    {
      "source": 16,
      "target": 20
    },
    {
      "source": 16,
      "target": 21
    },
    {
      "source": 16,
      "target": 34
    },
    {
      "source": 16,
      "target": 35
    },
    {
      "source": 16,
      "target": 38
    },
    {
      "source": 16,
      "target": 17
    },
    {
      "source": 17,
      "target": 20
    },
    {
      "source": 17,
      "target": 21
    },
    {
      "source": 17,
      "target": 22
    },
    {
      "source": 17,
      "target": 34
    },
    {
      "source": 17,
      "target": 35
    },
    {
      "source": 17,
      "target": 36
    },
    {
      "source": 17,
      "target": 38
    },
    {
      "source": 17,
      "target": 39
    },
    {
      "source": 17,
      "target": 18
    },
    {
      "source": 18,
      "target": 21
    },
    {
      "source": 18,
      "target": 22
    },
    {
      "source": 18,
      "target": 23
    },
    {
      "source": 18,
      "target": 35
    },
    {
      "source": 18,
      "target": 19
    },
    {
      "source": 19,
      "target": 22
    },
    {
      "source": 19,
      "target": 23
    },
    {
      "source": 19,
      "target": 20
    },
    {
      "source": 20,
      "target": 23
    },
    {
      "source": 20,
      "target": 24
    },
    {
      "source": 20,
      "target": 25
    },
    {
      "source": 20,
      "target": 26
    },
    {
      "source": 20,
      "target": 27
    },
    {
      "source": 20,
      "target": 30
    },
    {
      "source": 20,
      "target": 31
    },
    {
      "source": 20,
      "target": 32
    },
    {
      "source": 20,
      "target": 34
    },
    {
      "source": 20,
      "target": 35
    },
    {
      "source": 20,
      "target": 21
    },
    {
      "source": 21,
      "target": 24
    },
    {
      "source": 21,
      "target": 26
    },
    {
      "source": 21,
      "target": 31
    },
    {
      "source": 21,
      "target": 32
    },
    {
      "source": 21,
      "target": 35
    },
    {
      "source": 21,
      "target": 22
    },
    {
      "source": 22,
      "target": 25
    },
    {
      "source": 22,
      "target": 26
    },
    {
      "source": 22,
      "target": 23
    },
    {
      "source": 23,
      "target": 24
    },
    {
      "source": 23,
      "target": 26
    },
    {
      "source": 23,
      "target": 27
    },
    {
      "source": 23,
      "target": 31
    },
    {
      "source": 24,
      "target": 25
    },
    {
      "source": 24,
      "target": 27
    },
    {
      "source": 25,
      "target": 26
    },
    {
      "source": 25,
      "target": 28
    },
    {
      "source": 26,
      "target": 27
    },
    {
      "source": 26,
      "target": 29
    },
    {
      "source": 26,
      "target": 30
    },
    {
      "source": 26,
      "target": 31
    },
    {
      "source": 27,
      "target": 30
    },
    {
      "source": 27,
      "target": 31
    },
    {
      "source": 27,
      "target": 32
    },
    {
      "source": 27,
      "target": 28
    },
    {
      "source": 28,
      "target": 31
    },
    {
      "source": 28,
      "target": 32
    },
    {
      "source": 28,
      "target": 33
    },
    {
      "source": 28,
      "target": 29
    },
    {
      "source": 29,
      "target": 32
    },
    {
      "source": 29,
      "target": 33
    },
    {
      "source": 29,
      "target": 34
    },
    {
      "source": 29,
      "target": 30
    },
    {
      "source": 30,
      "target": 33
    },
    {
      "source": 30,
      "target": 34
    },
    {
      "source": 30,
      "target": 35
    },
    {
      "source": 30,
      "target": 31
    },
    {
      "source": 31,
      "target": 34
    },
    {
      "source": 31,
      "target": 35
    },
    {
      "source": 31,
      "target": 36
    },
    {
      "source": 31,
      "target": 32
    },
    {
      "source": 32,
      "target": 35
    },
    {
      "source": 32,
      "target": 36
    },
    {
      "source": 32,
      "target": 37
    },
    {
      "source": 32,
      "target": 33
    },
    {
      "source": 33,
      "target": 36
    },
    {
      "source": 33,
      "target": 37
    },
    {
      "source": 33,
      "target": 38
    },
    {
      "source": 33,
      "target": 34
    },
    {
      "source": 34,
      "target": 37
    },
    {
      "source": 34,
      "target": 38
    },
    {
      "source": 34,
      "target": 39
    },
    {
      "source": 34,
      "target": 35
    },
    {
      "source": 35,
      "target": 38
    },
    {
      "source": 35,
      "target": 39
    },
    {
      "source": 35,
      "target": 40
    },
    {
      "source": 35,
      "target": 36
    },
    {
      "source": 36,
      "target": 39
    },
    {
      "source": 36,
      "target": 40
    },
    {
      "source": 36,
      "target": 41
    },
    {
      "source": 36,
      "target": 37
    },
    {
      "source": 37,
      "target": 40
    },
    {
      "source": 37,
      "target": 41
    },
    {
      "source": 37,
      "target": 38
    },
    {
      "source": 38,
      "target": 41
    },
    {
      "source": 38,
      "target": 39
    },
    {
      "source": 39,
      "target": 40
    },
    {
      "source": 40,
      "target": 41
    }
  ]
}

Could you please help with this? Any help would be much appreciated!

fgrunewald commented 2 years ago

Hi @l454025801,

Happy to help as you're almost there. As you want to connect 4 itp-files all of the residues in the residue graph need to have the "from_itp" label with the value set to that of the molecule name. So your command for making the graph should be more like this:

polyply gen_seq -f C12.itp VVKK.itp OEG_4.itp ../Z33/Z33_mar3.itp -from_file c:C12 v:VVKK o:O4 z:Z33\
-seq c v o z -connects 0:1:0-0 1:2:3-0 2:3:3-0 -o seq.json -name test \
-label 0:"from_itp":"C12-1" 1:"from_itp":"VVKK-1" 2:"from_itp":"OEG4-1" 3:"from_itp":Z33-1

Please note that in the last line of this command I simply guessed your molecule names. You may have to adjust those. Finally in case you haven't done it you will need to install the version from GitHub not pypi in order to avoid one bug that only recently has been fixed.

Also be aware that in your link file the indices seem strange. Note that by_atom_id refers to the atom ids in the final molecule. For example the bond 5 5 1 0.41 2000 would result in a bond between atom 5 with itself NOT between atom 5 in two bonded residues. It is easiest to first just stitch together the itp files and then see which atoms you want to connect and adjust the links.

I hope this helps! Please let me know if there are any other issues.

If you want a "clean example" have a look at the commands below:

  1. First we make some itp files to be connected
    polyply gen_params -lib martini3 -seq PEO:2 -o A.itp -name PEO
    polyply gen_params -lib martini3 -seq PS:2 -o B.itp -name PS
    polyply gen_params -lib martini3 -seq PE:2 -o C.itp -name PE
  2. Next we generate the sequence graph
    polyply gen_seq -f A.itp B.itp C.itp -from_file a:PEO b:PS c:PE -seq a b c -connects 0:1:0-0 1:2:1-0 \
    -o seq.json -name test -label 0:"from_itp":"PEO-1" 1:"from_itp":PS-1 2:"from_itp":PE-1
  3. Now we write the link file.
    [ link ]
    [ molmeta ]
    by_atom_id true
    [ bonds ]
    2  6   1 3000 0.43 ; bond between backbone PEO and PS
    10 11 1 3000 0.43 ; bond between backbone PS and PE
  4. The we generate the final itp, which should run without warnings.
    polyply gen_params -f A.itp B.itp C.itp link.ff -seqf seq.json -o test.itp -name test
l454025801 commented 2 years ago

Thank you very much! It works alright now!

fgrunewald commented 2 years ago

Good to hear! I will convert this issue to a discussion so that other people can see it as well. But feel free to still comment here when you have any other problems related to this