Getting Started#

This guide will help you get started with using mrDNA for DNA molecular modeling.

Basic Usage#

Here’s a simple example that creates a DNA structure:

# Import necessary modules
from mrdna.segmentmodel import SegmentModel
from mrdna.model.dna_sequence import DNASequence

# Create a segment model
model = SegmentModel()

# Add a DNA segment with a specific sequence
sequence = DNASequence("GATTACA")
model.add_segment(sequence)

# Save the model to a PDB file
model.to_pdb("example.pdb")

Working with Existing Structures#

mrDNA can read structures from various file formats:

# Import the appropriate reader
from mrdna.readers.segmentmodel_from_pdb import SegmentModelFromPDB

# Load a structure from a PDB file
model = SegmentModelFromPDB("my_structure.pdb")

# Analyze the structure
num_nucleotides = model.count_nucleotides()
print(f"Structure contains {num_nucleotides} nucleotides")

Multi-Resolution Simulation#

The primary feature of mrDNA is its ability to perform multi-resolution simulations:

from mrdna.simulate import multiresolution_simulation

# Perform a multi-resolution simulation
output_directory = multiresolution_simulation(
    model,
    output_name='my_simulation',
    coarse_steps=1e6,
    fine_steps=1e6
)

print(f"Simulation results stored in: {output_directory}")