Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: take into account [ atomtype ] section when including itp files #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

PabloNA97
Copy link

Hi! It's me again :)

First of all some I wanted to include several ligands into the same .top file calling append_ligand() iteratively. However when doing so, the BioBB simply added the corresponding include directives in the main topology and I ended up in a situation like the following:

; Include forcefield parameters
#include "forcefield.itp" 

; Including ligand ITP
#include "ligand_1.itp"

; Ligand position restraints
#ifdef POSRES_LIGAND
#include "ligand_1.itp"
#endif

; Including ligand ITP
#include "ligand_2.itp"

; Ligand position restraints
#ifdef POSRES_LIGAND
#include "ligand_2.itp"
#endif

[ moleculetype ]
; Name            nrexcl
Protein_chain_A     3

...

The issue with this situation is that each ligand itp file might contain an [ atomtype ] directive as well as the corresponding [ moleculetype ]. In that case we would be alternating [ atomtype ] with [ moleculetype ] directives in the .top file. This leads to an error as explained here.. The solution is given by Justin Lemkul in the same thread:

"If your ligand topologies both introduce new atom types (or any other force field parameters), you have to collect them and declare those directives before any [moleculetype] can be introduced. The entire force field has to be complete before any molecules can be defined. See the Error FAQ page for more information."

So what I've done is to cut the [ atomtype ] directive from the input itp we want to include (if there is any) and merge it with the [ atomtype ] directive in the input .top file (if there is any).

And alternative approach to this one would be to always write [ atomtype ] directives in a separate file. This would require more work and I'm not sure the final solution would be much better.

Of course the piece of code that takes care of this could be separated into a method of the AppendLigand BioBB or a common.py file.

I left some comments regarding additional situations that should be taken into account and would require more work:

            # NOTE: Check for repeated atoms in the [ atomtypes ] section
            # NOTE: raise error if there are conflicts - atoms named equally with different parameters
            # NOTE: raise error if there are different number of columns in the atomtypes sections

I hope this is useful, as always feel free to modify or discard as you think is best.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant