from kimmdy.parsing import read_top
from kimmdy.topology.topology import Topology
from pathlib import Path
from kimmdy.tools import write_top_as_dot
import copy
Visualize Topologies
Capped Alanine with a radical
This is the same reaction that would occur in the naive alanine HAT example (and integration test) if if where used with the dummy_first
kmc method instead of standard rfkmc
.
= read_top(Path('../../tests/test_files/test_integration/alanine_hat_naive/Ala_out.top'), use_gmx_dir=False)
path_a = Topology(path_a)
top = copy.deepcopy(top)
top_a = top
top_b
'7', '8'))
top_b.break_bond(('8', '9'))
top_b.bind_bond((
"ala-top-a.dot")
write_top_as_dot(top_a, "ala-top-b.dot") write_top_as_dot(top_b,
Or we can look at a different HAT used in the unit tests:
= read_top(Path('../../tests/test_files/test_integration/alanine_hat_naive/Ala_out.top'), use_gmx_dir=False)
path_a = Topology(path_a)
top
# move the radical to N16 before we start the reaction
"16", "17"))
top.break_bond(("9", "17"))
top.bind_bond((= copy.deepcopy(top)
top_a = top
top_b
"18", "21"))
top_b.break_bond(("16", "21"))
top_b.bind_bond((
"ala-top-2-a.dot")
write_top_as_dot(top_a, "ala-top-2-b.dot") write_top_as_dot(top_b,
Multiple molecules
= read_top(Path('../../tests/test_files/test_topology/urea.top'), use_gmx_dir=False)
urea_dict = Topology(urea_dict)
urea "urea-top.dot") write_top_as_dot(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
= read_top(Path('../../tests/test_files/test_topology/urea-times-2.top'), use_gmx_dir=False)
urea_dict = Topology(urea_dict)
urea "urea-2-top.dot") write_top_as_dot(urea,
We end up with
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).