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 copyVisualize 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.
path_a = read_top(Path('../../tests/test_files/test_integration/alanine_hat_naive/Ala_out.top'), use_gmx_dir=False)
top = Topology(path_a)
top_a = copy.deepcopy(top)
top_b = top
top_b.break_bond(('7', '8'))
top_b.bind_bond(('8', '9'))
write_top_as_dot(top_a, "ala-top-a.dot")
write_top_as_dot(top_b, "ala-top-b.dot")Or we can look at a different HAT used in the unit tests:
path_a = read_top(Path('../../tests/test_files/test_integration/alanine_hat_naive/Ala_out.top'), use_gmx_dir=False)
top = Topology(path_a)
# move the radical to N16 before we start the reaction
top.break_bond(("16", "17"))
top.bind_bond(("9", "17"))
top_a = copy.deepcopy(top)
top_b = top
top_b.break_bond(("18", "21"))
top_b.bind_bond(("16", "21"))
write_top_as_dot(top_a, "ala-top-2-a.dot")
write_top_as_dot(top_b, "ala-top-2-b.dot")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")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 1000urea_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
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).
Rings
top = Topology.from_path('../../tests/test_files/test_topology/TdT_from_pdb2gmx.top')
write_top_as_dot(top, "dna.dot")len(top.improper_dihedrals.keys())8
topTopology with the following molecules:
Reactive: 1
SOL: 4030
With Moleculetype Reactive with:
63 atoms,
68 bonds,
132 angles,
188 pairs,
0 settles,
0 exclusions,
216 proper dihedrals
8 improper dihedrals
0 position restraints
0 dihedral restraints
ForceField parameters with
88 atomtypes,
194 bondtypes,
547 angletypes,
744 proper dihedraltypes
72 improper dihedraltypes
129 residuetypes