Problem in using gentop

Hi @vgapsys,
I have been trying my hand in protein mutations and while using the pmx gentop to fill in the B states I have been encountering an error like this:

pmx gentop -f topol.top -o newtop.top -ff ./mutff45/charmm36mut.ff/

log_> Reading input top file "topol.top"
log_> Making bonds for state B -> 0 bonds with perturbed atoms
log_> Making angles for state B -> 0 angles with perturbed atoms
log_> Making dihedrals for state B -> 0 dihedrals with perturbed atoms
log_> Removed 0 fake dihedrals
log_> Total charge of state A = 0
log_> Total charge of state B = 0

log_> Reading input itp file "topol_Protein_chain_A.itp""
Traceback (most recent call last):
  File "/home/ps004/anaconda3/envs/pmx/bin/pmx", line 8, in <module>
    sys.exit(entry_point())
  File "/home/ps004/anaconda3/envs/pmx/lib/python3.10/site-packages/pmx/scripts/cli.py", line 97, in entry_point
    PmxCli()
  File "/home/ps004/anaconda3/envs/pmx/lib/python3.10/site-packages/pmx/scripts/cli.py", line 44, in __init__
    getattr(self, args.command)()
  File "/home/ps004/anaconda3/envs/pmx/lib/python3.10/site-packages/pmx/scripts/cli.py", line 52, in gentop
    generate_hybrid_topology.entry_point()
  File "/home/ps004/anaconda3/envs/pmx/lib/python3.10/site-packages/pmx/scripts/generate_hybrid_topology.py", line 180, in entry_point
    main(args)
  File "/home/ps004/anaconda3/envs/pmx/lib/python3.10/site-packages/pmx/scripts/generate_hybrid_topology.py", line 143, in main
    pmxtop, pmxitps = gen_hybrid_top(topol=topol, recursive=recursive,
  File "/home/ps004/anaconda3/envs/pmx/lib/python3.10/site-packages/pmx/alchemy.py", line 296, in gen_hybrid_top
    topol2 = Topology(itp_filename, ff=ff, version='new')
  File "/home/ps004/anaconda3/envs/pmx/lib/python3.10/site-packages/pmx/forcefield.py", line 1750, in __init__
    self.assign_fftypes()
  File "/home/ps004/anaconda3/envs/pmx/lib/python3.10/site-packages/pmx/forcefield.py", line 1787, in assign_fftypes
    atom.type = self.NBParams.atomtypes[atom.atomtype]['bond_type']
KeyError: 'NP'

In the above mentioned case, the topol.top does have the include statement pointing towards the force field.

Moreover the same happens with individual itp files for the two chains.
However, when I use the individual topology files(itp) for both the chains of the protein using the norecursive option, it is able to fill in the b-states.

Regards,
Pallav

Hi all,
I was doing it the wrong way.
Followed the steps as provided in the tutorial Mutation free energy to generate the mutant structure and the hybrid topologies and it did pretty well.
Cheers,
Pallav

1 Like

Great to see that the issue was resolved.

Did you also identify what exactly was triggering the error earlier? Did you need to modify the command line? Or maybe updated the pmx version?

Hi @vgapsys,
I could not identify why it was causing an error.
The thing I did was copy the force field I was using into the “./data” directory of “pmx” where the force fields resides and simply exported GMXLIB to that directory and used the
pmx gentop -f topol.top -o newtop.top

I could not understand why was it not working from my local directory.

Could it be that the pmx mutation force fields were not in the GMXLIB path?

I was exporting the GMXLIB path to my local directory where it contained the necessary files such as residuetypes.dat etc.

pmx protein mutations use modified force field files which define mutated residues. These force fields need to be in the GMXLIB path

Yes but then there are other residues in my protein, co-factors etc. which are not defined in the pmx mutated force fields where I add those cgenff(such as cgenff.rtp) files from the recent CHARMM port of GROMACS.

In this case you will need to add to co-factors and other residues to the pmx force field containing information about the mutations. Or, alternatively, copy mutation information into your force field.

1 Like

I wonder why it does not works from the local directory.

How exactly was it set up? Did you take the force field containing mutation residue information, place it in the local folder and then “pmx gentop” was not able to locate the forcefield? I just tested this procedure by running from within the “mutff” folder where all the pmx force fields are. This works even when the $GMXLIB is empty.

Yes that’s what I had done with a folder containing all the itp/rtp/mtp files for aminoacids or mutres etc. for which I had exported the path for GMXLIB. As you can see in the first post https://ask.bioexcel.eu/t/problem-in-using-gentop/4073?u=s.pallav here, I had called the force field from the local directory and $GMXLIB was put to the local directory.
The only reason for my concern is as I have to go for data generating phase I would have to transfer the files to a cluster where things could go messy with the relative paths of the files.

Probably I was being foolish with GMXLIB path. Have understood it.
Apologies.
Regards,
Pallav.