# Modifying a forcefield to include custom residues

**URL:** <https://gromacs.bioexcel.eu/t/modifying-a-forcefield-to-include-custom-residues/8320>\
**Category:** User discussions\
**Created:** [February 12, 2024, 10:13am UTC](https://gromacs.bioexcel.eu/t/modifying-a-forcefield-to-include-custom-residues/8320 "2024-02-12T10:13:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lwperrin](https://avatars.discourse-cdn.com/v4/letter/l/47e85d/32.png) [@lwperrin](https://gromacs.bioexcel.eu/u/lwperrin)\
**Post date:** [February 12, 2024, 10:13am UTC](https://gromacs.bioexcel.eu/t/modifying-a-forcefield-to-include-custom-residues/8320/1 "2024-02-12T10:13:21Z")

</div>

GROMACS version: 2022  
GROMACS modification: Yes

Hello, I currently want to simulate interactions between hexagonal boron nitride and different amino-acids, and I tried to modify the CHARMM27 forcefield as described in the following article’s supplementary materials ([https://pubs.acs.org/doi/suppl/10.1021/acs.langmuir.9b03121/suppl\_file/la9b03121\_si\_001.pdf](https://pubs.acs.org/doi/suppl/10.1021/acs.langmuir.9b03121/suppl_file/la9b03121_si_001.pdf)) by adding residues and values to “atomtypes.atp”, “ffnonbonded.itp”, and added a “bn.itp” file that I included in the “forcefield.itp” file (everything in the charmm27.ff folder). However, when I run the gromacs command “gmx pdb2gmx -f myfile.pdb”, I get the following error: “Residue ‘BN’ not found in residue topology database”.  
Did I do anything wrong to build this topology or miss any step?

Best,  
Louis

---

<div class="post-metadata">

**Author:** ![FarzaneJP](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/farzanejp/32/1211_2.png) [@FarzaneJP](https://gromacs.bioexcel.eu/u/FarzaneJP)\
**Post date:** [February 12, 2024, 12:56pm UTC](https://gromacs.bioexcel.eu/t/modifying-a-forcefield-to-include-custom-residues/8320/2 "2024-02-12T12:56:17Z")

</div>

First check the common errors: [https://manual.gromacs.org/2018.1/user-guide/run-time-errors.html#residue-xxx-not-found-in-residue-topology-database](https://manual.gromacs.org/2018.1/user-guide/run-time-errors.html#residue-xxx-not-found-in-residue-topology-database)

Also consider:

- After running `pdb2gmx`, check the `topol.top` file to ensure that the ‘BN’ residue is correctly listed and referenced. The `[moleculetype]` and `[atoms]` sections should include the necessary information.

- Ensure that GROMACS is using the modified forcefield files
