marrink-lab / vermouth-martinize

Describe and apply transformation on molecular structures and topologies
Apache License 2.0
89 stars 40 forks source link

Use for other molecules ( FAD, PEG) #388

Closed dim-99 closed 2 years ago

dim-99 commented 2 years ago

Hi,

Is it possible to use this plugin for other molecules like FAD and PEG (now that we have parameters for these molecules ?)

Thank you

dim-99 commented 2 years ago

Update I tried to use -from to point out the charmm.rtf file, still the forcefield is not identified.

Thanks

pckroon commented 2 years ago

Hi, yes, the code can (in principle) deal with any type of molecule, as long as the required datafiles are present. I would welcome PRs that add data files.

Update I tried to use -from to point out the charmm.rtf file, still the forcefield is not identified.

What did you try exactly? What did you try to achieve? What was the command line you used? Did you read the (admittedly sparse) documentation?

dim-99 commented 2 years ago

Thank you for the reply.

I made a directory named charmm with .rtp file for FAD molecule (which I retrieved from CGENFF and I converted the .rtf file to .rtp by hand) and another directory with FAD.charmm.map where I mapped atoms in the .pdb file to martini22 beads.

Used the command martinize2 -f fad.pdb -x fad-cg.pdb -o fad.top -ff martini22 -from charmm/fad.rtp -map-dir martini-map I get the error Traceback (most recent call last): File "/apps/vermouth-martinize/0.7.2/bin/martinize2", line 797, in entry() File "/apps/vermouth-martinize/0.7.2/bin/martinize2", line 577, in entry raise ValueError('Unknown force field "{}".'.format(args.from_ff)) ValueError: Unknown force field

Thank you again for your patience. I went through the documentation several times, but I can't get through this error.

pckroon commented 2 years ago

Thanks for the details. You should specify not the file, but the folder: -ff-dir ./charmm -from charmm*. You can check whether it picks up on your new blocks with -list-blocks, and try -list-ff to see which force fields are found.

dim-99 commented 2 years ago

Thank you again.

I tried the following,

martinize2 -f fad.pdb -x fad-cg.pdb -o fad.top -ff-dir ./forcefields -from forcefields/charmm/FAD.rtp it returns the same error ValueError: Unknown force field

When I neglect do martinize2 -f fad.pdb -x fad-cg.pdb -o fad.top -ff-dir ./forcefields -list-ff it shows charmm as one of the options, but when I do list-blocks it doesn't pick up any charmm blocks. Am I doing something wrong again?

Thank you ! I appreciate it

pckroon commented 2 years ago

... it shows charmm as one of the options...

So do -from charmm. (or -to charmm). list-blocks needs you to select a valid FF before it can print the blocks in a force field.

dim-99 commented 2 years ago

Thanks again Peter!

I tried martinize2 -f fad.pdb -x fad-cg.pdb -o fadtopol.top -ff-dir ./forcefields -from charmm -ff nucleotideff -map-dir martinimap In the nucleotideff folder I have nucleotide.ff (which has force field definition for FAD) and other martini22 .itp and .ff files I copied from force field folder of installation files.

I get the error,

Traceback (most recent call last):
  File "/apps/vermouth-martinize/0.7.2/bin/martinize2", line 797, in <module>
    entry()
  File "/apps/vermouth-martinize/0.7.2/bin/martinize2", line 556, in entry
    partial_mapping = read_mapping_directory(directory,
  File "/apps/vermouth-martinize/0.7.2/lib/python3.10/site-packages/vermouth/map_input.py", line 427, in read_mapping_directory
    new_mappings = read_backmapping_file(infile, force_fields)
  File "/apps/vermouth-martinize/0.7.2/lib/python3.10/site-packages/vermouth/map_input.py", line 110, in read_backmapping_file
    map_obj = make_mapping_object(from_block, to_block, mapping,
  File "/apps/vermouth-martinize/0.7.2/lib/python3.10/site-packages/vermouth/map_input.py", line 166, in make_mapping_object
    idx_to = to_name_to_idx[atname_to]
KeyError: 'Qa'

My mapping file looks like this,

[ molecule ]
FAD

[from]
charmm

[to]
nucleotideff

[ nucleotide ]
Qa P3 SC3 SN0 SNa SP3 N0 P4

[ mapping ]
charmm27 charmm36

[ atoms ]
    1    PA    Qa 
    2   O1A    Qa
    3   O2A    Qa
    5   O5B    Qa
    8   O3P    Qa
   11   O1P    Qa 
   14   O2P    Qa
   15     P    Qa
   16   O5'    Qa
   17   C5'    P3
   18   O4'    P3
   19   C3'    P3
   20   O3'    P3
   21   C2'    P3
   22   O2'    P3
   24   C8M   SC3
   25    C8   SC3
   26   C7M   SC3
   27    C9   SN0
   28   C9A   SN0
   29   N10   SN0
   30   C10   SN0
   31    C6   SNa
   32   C5X   SNa
   33    N5   SNa
   34   C4X   SNa
   35    N1   SP3
   36    C2   SP3
   37    O2   SP3
   38    N3   SP3
   39    C4   SP3
   40    O4   SP3
   41   N9A   SNa
   42   C8A   SNa
   43   N7A   SNa
   44   N1A   SNa
   45   N3A   SNa
   46   C2A   SNa
   47   C1B    N0
   48   O4B    N0
   49   C4B    N0
   50   C5B    N0
   51   O2B    P4
   52   C2B    P4
   53   C3B    P4
   54   O3B    P4
pckroon commented 2 years ago

Mappings map by atom/name/, not /type/. The block you added to the martini forcefield for ~your lipid~ FAD defines which atom types will be assigned to the atoms.

dim-99 commented 2 years ago

Thank you @pckroon !

Tsjerk commented 2 years ago

@pckroon Can this issue be closed? It helps to have less issues open.

dim-99 commented 2 years ago

Thank you ! I'll close the issue , thanks again for the guidance!