open3spn2 icon indicating copy to clipboard operation
open3spn2 copied to clipboard

Add production run python scripts

Open stevenluo22 opened this issue 1 year ago • 2 comments

Add production run python scripts as well as other ancillary example scripts

Summary by Sourcery

Add new Python scripts for production runs and protein-DNA analysis, enhancing the simulation capabilities and force calculations in the DNA analysis scripts.

New Features:

  • Introduce new Python scripts for running production simulations and analyzing protein-DNA interactions.

Enhancements:

  • Enhance DNA analysis scripts by adding new force calculations and simulation setup.

stevenluo22 avatar Nov 18 '24 20:11 stevenluo22

Reviewer's Guide by Sourcery

This PR adds production run Python scripts and analysis tools for DNA-protein simulations. The main changes include adding a new production run script with comprehensive simulation setup, modifying the DNA analysis script to remove protein-related code, and adding new analysis tools for computing DNA twist angles.

Sequence diagram for DNA-Protein Simulation Setup

sequenceDiagram
    participant User
    participant Script
    participant OpenMM
    participant DNA
    participant Protein
    participant ForceField
    participant Simulation
    User->>Script: Run simulation script
    Script->>OpenMM: Initialize platform
    Script->>DNA: Create DNA object
    Script->>Protein: Create Protein object
    Script->>ForceField: Create force field
    ForceField->>Simulation: Create system
    Script->>Simulation: Initialize simulation
    Simulation->>Simulation: Add forces
    Simulation->>Simulation: Run simulation steps
    Simulation->>User: Output results

Sequence diagram for DNA Twist Angle Computation

sequenceDiagram
    participant User
    participant Script
    participant DNA
    participant ComputeTwist
    User->>Script: Run twist computation script
    Script->>DNA: Load DNA structure
    Script->>ComputeTwist: Compute twist angles
    ComputeTwist->>Script: Return twist angles
    Script->>User: Output twist angles

Class diagram for DNA and Protein Simulation

classDiagram
    class DNA {
        +fromCoarsePDB(file: str)
        +periodic: bool
    }
    class Protein {
        +fromCoarsePDB(file: str, sequence: str)
        +setup_virtual_sites(system)
        +periodic: bool
    }
    class ForceField {
        +createSystem(topology)
    }
    class Simulation {
        +context: Context
        +reporters: list
        +step(steps: int)
        +minimizeEnergy()
        +loadCheckpoint(file: str)
    }
    class Context {
        +setPositions(positions)
        +setVelocitiesToTemperature(temperature)
        +getState(getEnergy: bool, groups: int)
    }
    class Integrator {
        +setTemperature(temperature)
    }
    class Platform {
        +getPlatformByName(name: str)
        +setPropertyDefaultValue(property: str, value: str)
    }
    DNA --> ForceField
    Protein --> ForceField
    ForceField --> Simulation
    Simulation --> Context
    Simulation --> Integrator
    Simulation --> Platform
    Context --> Integrator
    Context --> Platform

File-Level Changes

Change Details Files
Added a new production run script for DNA-protein simulations
  • Implemented command-line argument parsing for simulation parameters
  • Added simulation platform and device configuration
  • Implemented checkpoint handling for simulation continuity
  • Added comprehensive force field setup for DNA-protein interactions
  • Implemented energy reporting and trajectory analysis
open3SPN2/scripts/protein_DNA_run.py
Modified DNA analysis script to focus on DNA-specific calculations
  • Removed protein-related code sections
  • Added DNA twist bias force calculations
  • Implemented extra bond force calculations
  • Updated force group assignments
examples/DNA_analysis.py
Added DNA twist computation utilities
  • Implemented vector manipulation functions
  • Added multiple methods for twist calculation
  • Implemented comparison functions between different twist calculation methods
  • Added test functionality for twist calculations
open3SPN2/compute_twist.py
Added analysis scripts for protein-DNA simulations
  • Implemented energy calculation and reporting
  • Added trajectory analysis capabilities
  • Added force field setup for analysis
  • Implemented platform-specific configurations
open3SPN2/scripts/protein_DNA_analysis.py
examples/protein_DNA_analysis.py
examples/DNA_analysis_PU1_AMHGo.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in the pull request body to generate a PR summary at any time. You can also use this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

  • Contact our support team for questions or feedback.
  • Visit our documentation for detailed guides and information.
  • Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.

sourcery-ai[bot] avatar Nov 18 '24 20:11 sourcery-ai[bot]

Newest commits have segregated relatively duplicate amongst forces terms code into separate forces_setup.py so you don't need to change the forces terms code multiple times across multiple scripts. This removes potential future errors down the road where one script (say run script) had modified inclusion of forces terms and another script forgot to modify (say analysis script).

And also updated and cleaned the info.dat generation file in the analysis script. Ensure to modify or at least check the analysis script, the info.dat generation parts, if you edit or customize the forces_setup.py file from the original. The info.dat file is verified to have Total Energies be the same as the intended terms (not Q or Rg) as of latest revisions.

stevenluo22 avatar Dec 20 '24 20:12 stevenluo22