use std::cell::RefCell;
use std::sync::Arc;

use numpy::ndarray::{Array2, Array3};
use numpy::{IntoPyArray, PyArray1, PyArray2};
use pyo3::exceptions::PyRuntimeError;
use pyo3::prelude::*;
use pyo3::types::{PyDict, PyModule};
use warp_pack::PackConfig as PackConfigInput;

use traj_core::error::TrajError;
use traj_core::frame::{Box3, FrameChunkBuilder};
use traj_core::selection::Selection;
use traj_core::system::System;
use traj_engine::{
    AlignPlan, AlignPrincipalAxisPlan, BondAngleDistributionPlan, BondLengthDistributionPlan,
    CenterOfGeometryPlan, CenterOfMassPlan, ChainRgPlan, ConductivityPlan, ContourLengthPlan,
    DielectricPlan, DipoleAlignmentPlan, DistancePlan, DistanceToPointPlan,
    DistanceToReferencePlan, EndToEndPlan, EquipartitionPlan, Executor, GroupBy, HbondPlan,
    IonPairCorrelationPlan, LagMode, MsdPlan, PairwiseDistancePlan, PairDistPlan, PbcMode,
    PersistenceLengthPlan, Plan, PlanOutput, PrincipalAxesPlan, RdfPlan, ReferenceMode,
    RgPlan, RadgyrTensorPlan, RmsdPerResPlan, RmsdPlan, SymmRmsdPlan, RmsfPlan, RotAcfPlan,
    StructureFactorPlan, WaterCountPlan, AtomicCorrPlan, VelocityAutoCorrPlan, XcorrPlan, WaveletPlan,
    SurfPlan, MolSurfPlan, TorsionDiffusionPlan, ToroidalDiffusionPlan, MultiPuckerPlan,
    AnglePlan, DihedralPlan, DihedralRmsPlan, RotateDihedralPlan, SetDihedralPlan, MindistPlan,
    PuckerPlan, ClosestAtomPlan, HausdorffPlan, LowestCurvePlan,
    FixImageBondsPlan, RandomizeIonsPlan,
    SearchNeighborsPlan, CheckStructurePlan, CheckChiralityPlan, AtomMapPlan,
    CenterTrajectoryPlan, CenterMode, TranslatePlan,
    TransformPlan, ImagePlan, VectorPlan, GetVelocityPlan, SetVelocityPlan, MeanStructurePlan,
    AverageFramePlan, MakeStructurePlan,
    DistanceRmsdPlan, PairwiseRmsdPlan, PairwiseMetric, NativeContactsPlan,
    RotatePlan, ScalePlan, AutoImagePlan, StripPlan, RotationMatrixPlan, SuperposePlan,
    MatrixPlan, MatrixMode, PcaPlan, ProjectionPlan, AnalyzeModesPlan,
    BfactorsPlan, AtomicFluctPlan, MultiDihedralPlan, PermuteDihedralsPlan, ClosestPlan,
    ReplicateCellPlan, XtalSymmPlan, VolumePlan, WatershellPlan,
    CountInVoxelPlan, DensityPlan, VolmapPlan,
};
use traj_io::dcd::DcdReader;
use traj_io::gro::GroReader;
use traj_io::pdb::PdbReader;
use traj_io::xtc::XtcReader;
use traj_io::{TopologyReader, TrajReader};
use traj_engine::plans::analysis::msd::{DtDecimation, FrameDecimation, TimeBinning};
use traj_engine::plans::analysis::rotacf::OrientationSpec;


include!("py_part1.rs");
include!("py_part2.rs");
include!("py_part3.rs");
include!("py_part4.rs");
include!("py_part5.rs");
include!("py_part6.rs");
include!("py_part7.rs");
include!("py_part8.rs");
include!("py_part9.rs");
