Visualize Topologies

Capped Alanine with a radical

from kimmdy.parsing import read_top
from kimmdy.topology.topology import Topology
from pathlib import Path
from kimmdy.tools import write_top_as_dot
ala_top = read_top(Path('../../tests/test_files/test_topology/Ala_R_prm.top'), use_gmx_dir=False)
top = Topology(ala_top)

write_top_as_dot(top, "ala-top.dot")
G 1 CT 1 CT 2 HC 2 HC 1 CT--2 HC 3 HC 3 HC 1 CT--3 HC 4 HC 4 HC 1 CT--4 HC 5 C 5 C 1 CT--5 C 6 O 6 O 5 C--6 O 7 N 7 N 5 C--7 N 8 H 8 H 7 N--8 H 9 CT 9 CT 7 N--9 CT 10 CT 10 CT 9 CT--10 CT 14 C 14 C 9 CT--14 C 11 HC 11 HC 10 CT--11 HC 12 HC 12 HC 10 CT--12 HC 13 HC 13 HC 10 CT--13 HC 15 O 15 O 14 C--15 O 16 N 16 N 14 C--16 N 17 H 17 H 16 N--17 H 18 CT 18 CT 16 N--18 CT 19 H1 19 H1 18 CT--19 H1 20 H1 20 H1 18 CT--20 H1 21 H1 21 H1 18 CT--21 H1
Figure 1: A diagram of the Ala topology

Multiple molecules

urea_dict = read_top(Path('../../tests/test_files/test_topology/urea.top'), use_gmx_dir=False)
urea = Topology(urea_dict)
write_top_as_dot(urea, "urea-top.dot")
G 1 C 1 C 2 O 2 O 1 C--2 O 3 N 3 N 1 C--3 N 6 N 6 N 1 C--6 N 4 H 4 H 3 N--4 H 5 H 5 H 3 N--5 H 7 H 7 H 6 N--7 H 8 H 8 H 6 N--8 H
Figure 2: Topology of one molecule of urea

When we want to run reactions within molecules that are either separate moleculetypes or multiples of the same moleculetype, KIMMDY can combine those into a single moleculetype and make multiples explicit.

i.e. if we have a topology with two molecules of urea defined as:

[ system ]
Urea in Water

[ molecules ]
;molecule name   nr.
Urea             2
SOL              1000
urea_dict = read_top(Path('../../tests/test_files/test_topology/urea-times-2.top'), use_gmx_dir=False)
urea = Topology(urea_dict)
write_top_as_dot(urea, "urea-2-top.dot")

We end up with

G 1 C 1 C 2 O 2 O 1 C--2 O 3 N 3 N 1 C--3 N 6 N 6 N 1 C--6 N 4 H 4 H 3 N--4 H 5 H 5 H 3 N--5 H 7 H 7 H 6 N--7 H 8 H 8 H 6 N--8 H 9 C 9 C 10 O 10 O 9 C--10 O 11 N 11 N 9 C--11 N 14 N 14 N 9 C--14 N 12 H 12 H 11 N--12 H 13 H 13 H 11 N--13 H 15 H 15 H 14 N--15 H 16 H 16 H 14 N--16 H
Figure 3: A diagram of the two urea molecules topology

This way, explicit atom numbers match up with the atom numbers in the coordinate file (or rather, line numbers - 2, since the numbers in the actual atomnr column can overflow due to the fixed-width file format).

Back to top