Fixtnkatypes is a python script to assign atom types for atoms in TINKER XYZ structures by using templates or user specified atom types.


Ficxtnkatypes requires python installed


To run fixtnkatypes simply type:

fixtnkatypes [options] infile

The available options are:


show program's version number and exit.

-h, —help

show this help message and exit.

-c, —credits

display credits.

-r RANGE, —range=RANGE

Select the atomic range in which assign atom types.


apply the atom type ATOMTYPE in the selected atomic range.


apply the atom types in the specified atomic range as they appear in the TINKER structure TEMPLATE.

-s SETUP, —setup=SETUP

read a setup file containing more atom types assignments (see Example section).

-o OUTPUT, —output=OUTPUT

specify the output file.


is the name of the input file.



Templates are TINKER structures (TINKER XYZ files) where at each atom is assigned the proper atom type for a given force field.
The template is then applyed to the input structure in order to correct the atom types in the specified range. A template typical is a molecule and is used when the very same molecule is replicated in the space to form, for instance, a molecular self-assembly.
Let's suppose to have a tinker box of 100 molecules of water with no or wrong atom types (box.unk). Also, we have 100 molecules of methane. To assign mm3 atom types to the water molecules in the box, let's use as template a single water molecule (having the very same internal atomic structure of those in the box) where mm3 atom types are assigned to the atoms.
If the water molecules are the first 300 atoms in the box, we can then use the following sintax:

fixtnkatypes -t water.mm3 -r 1 300 -o box.mm3 box.unk

Here we have applied the template water.mm3 to box.unk in the range from atom 1 to 300 and saved the box with the mm3 atom types in box.mm3

In the same way, we can assign the mm3 atom types for hexane molecules using a template hexane.mm3:

fixtnkatypes -t methane.mm3 -r 301 700 -o finalbox.mm3 box.mm3

here we have applied the template to all the methane molecules and used as box the one created before, where we have fixed the atom types for water. The final structure, in finalbox.mm3, has mm3 atom types for all the atoms.

Direct assignment of an atom type

Sometimes, the use of a template is not worthy, since we have only a kind of atom in a structure (or ina part of it). Let suppose to have created a carbon nanotube or a sheet of HOPG graphite: all the atoms have the same atom types if the structure is periodic.
We can avoid to use a template and assign directly the proper atom type to the atoms in the proper range.
Let's assign mm3 atom types to all the 6000 atoms forming a carbon nanotube. This will do the trick:

fixtnkatypes -a 50 -r 1 6000 -o cnt.mm3 cnt.unk

Use a Setup file

We saw before the example of the solvent box containing a mixture of water and methane. We can assign the atom types for both king of molecules in one go using a setup file and running fixtnkatypes with the flag -s.

A setup file is just a fle containing a list of fixtnkatypes tasks, one per line.
For the example of the box, a valid setup file is:

-t water.mm3 -r 1 300
-t methane.mm3 -r 301 700

then use the command:
fixtnkatypes -s setup -o finalbox.mm3 box.unk

This will give the same result seen before for the use of templates, but just in one go.


You are free to use, modify and redistribute fixtnkatypes as far as you keep them free as in beer.
As free(as in beer)ware software, fixtnkatypes comes with _ABSOLUTE_ _NO_ (as in NOTHING, NADA, NICTHS, NIENTE, RIEN) WARRANTY. The author is _NOT_ responsible if those software will erase your hard disks, empty your bank account, stole your car, seduce your wife, shave your dog or make any kind of mess and damages, including loss of data or worst. By using polybuild and its libraries, you _ACCEPT_ these terms.


You can download fixtnkatypes here

Rate this page:

rating: 0+x

Add a New Comment
or Sign in as Wikidot user
(will not be published)
- +
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License