pdbrenumber
This is part of the cltools module

Modify atom numbers in a PDB, possibly using hybrid-36 coding.

When reading a PDB files, PLUMED honors the serial number of each atom. This command can be used to process a PDB file changing the atom serial numbers. Notice that the resulting list might have gaps. It is however fundamental that atom numbers correspond to those used within the MD code. Importantly, if the serial number of an atom is greater than 99999, it is written in hybrid-36 notation (see pdbreader). The main use of pdbrenumber is thus that of producing files where atoms are numbered using hybrid-36 convention.

The output PDB file is identical to the input PDB file, except for the atom number field. The rest of the line is written unchanged to the output file, even if it is incorrectly formatted. Residue numbers are not touched, and atom numbers in the input file are ignored.

Compulsory keywords
--ipdb specify the name of the input PDB file
--opdb specify the name of the output PDB file
Options
--help/-h

( default=off ) print this help

--firstatomnumber specify the desired serial number of the first atom of the output file
--atomnumbers specify the desired serial numbers of the atoms of the output file using a separate list
Examples

By default, pdbreader just sets the numbers as progressive starting from 1. For instance the following command:

> plumed pdbrenumber --ipdb input.pdb --opdb output.pdb

will copy file input.pdb to output.pdb replacing all the serial atoms with increasing numbers starting from one. Atoms that have an index that is greater than 99999 will be written in the output PDB file in hybrid-36 code.

It is possible to set a different serial number for the first atom, letting the following ones grow by one at each line. Here for instance the first atom will be assigned serial 1000, the second serial 1001, etc:

> plumed pdbrenumber --ipdb input.pdb --opdb output.pdb --firstatomnumber 1000

If the first atom number is >99999, it should be given as a decimal number (not in hybrid-36 code). However, numbers >99999 in the output PDB file will be written in hybrid-36 code.

As an alternative, one can provide a list of atoms as one per line in an auxiliary file.

> plumed pdbrenumber --ipdb input.pdb --opdb output.pdb --atomnumbers list.txt

The list.txt file might be something like this

120000
120001
120002
1
2
3

Numbers >99999 in the list should be provided as decimal numbers (not in hybrid-36 code). However, numbers >99999 in the output PDB file will be written in hybrid-36 code. Notice that there should be at least enough lines in list.txt as many atoms in the PDB file. Additional lines in list.txt will just be ignored.