Ejemplo n.º 1
0
void
TrajectoryAnalysisRunnerCommon::initOptions(Options *options)
{
    TrajectoryAnalysisSettings &settings = impl_->settings_;

    // Add options for help.
    options->addOption(BooleanOption("h").store(&impl_->bHelp_)
                           .description("Print help and quit"));
    options->addOption(BooleanOption("hidden").store(&impl_->bShowHidden_)
                           .hidden()
                           .description("Show hidden options"));
    options->addOption(BooleanOption("quiet").store(&impl_->bQuiet_)
                           .hidden()
                           .description("Hide options in normal run"));

    // Add common file name arguments.
    options->addOption(FileNameOption("f")
                           .filetype(eftTrajectory).inputFile()
                           .store(&impl_->trjfile_)
                           .defaultBasename("traj")
                           .description("Input trajectory or single configuration"));
    options->addOption(FileNameOption("s")
                           .filetype(eftTopology).inputFile()
                           .store(&impl_->topfile_)
                           .defaultBasename("topol")
                           .description("Input structure"));
    options->addOption(FileNameOption("n")
                           .filetype(eftIndex).inputFile()
                           .store(&impl_->ndxfile_)
                           .defaultBasename("index")
                           .description("Extra index groups"));
    options->addOption(SelectionFileOption("sf"));

    // Add options for trajectory time control.
    options->addOption(DoubleOption("b").store(&impl_->startTime_).timeValue()
                           .description("First frame (%t) to read from trajectory"));
    options->addOption(DoubleOption("e").store(&impl_->endTime_).timeValue()
                           .description("Last frame (%t) to read from trajectory"));
    options->addOption(DoubleOption("dt").store(&impl_->deltaTime_).timeValue()
                           .description("Only use frame if t MOD dt == first time (%t)"));

    // Add time unit option.
    settings.impl_->timeUnitManager.addTimeUnitOption(options, "tu");

    // Add plot options.
    settings.impl_->plotSettings.addOptions(options);

    // Add common options for trajectory processing.
    if (!settings.hasFlag(TrajectoryAnalysisSettings::efNoUserRmPBC))
    {
        options->addOption(BooleanOption("rmpbc").store(&settings.impl_->bRmPBC)
                               .description("Make molecules whole for each frame"));
    }
    if (!settings.hasFlag(TrajectoryAnalysisSettings::efNoUserPBC))
    {
        options->addOption(BooleanOption("pbc").store(&settings.impl_->bPBC)
                               .description("Use periodic boundary conditions for distance calculation"));
    }
}
Ejemplo n.º 2
0
void
TrajectoryAnalysisRunnerCommon::initOptions(IOptionsContainer *options,
                                            TimeUnitBehavior  *timeUnitBehavior)
{
    TrajectoryAnalysisSettings &settings = impl_->settings_;

    // Add common file name arguments.
    options->addOption(FileNameOption("f")
                           .filetype(eftTrajectory).inputFile()
                           .store(&impl_->trjfile_)
                           .defaultBasename("traj")
                           .description("Input trajectory or single configuration"));
    options->addOption(FileNameOption("s")
                           .filetype(eftTopology).inputFile()
                           .store(&impl_->topfile_)
                           .defaultBasename("topol")
                           .description("Input structure"));

    // Add options for trajectory time control.
    options->addOption(DoubleOption("b")
                           .store(&impl_->startTime_).storeIsSet(&impl_->bStartTimeSet_)
                           .timeValue()
                           .description("First frame (%t) to read from trajectory"));
    options->addOption(DoubleOption("e")
                           .store(&impl_->endTime_).storeIsSet(&impl_->bEndTimeSet_)
                           .timeValue()
                           .description("Last frame (%t) to read from trajectory"));
    options->addOption(DoubleOption("dt")
                           .store(&impl_->deltaTime_).storeIsSet(&impl_->bDeltaTimeSet_)
                           .timeValue()
                           .description("Only use frame if t MOD dt == first time (%t)"));

    // Add time unit option.
    timeUnitBehavior->setTimeUnitFromEnvironment();
    timeUnitBehavior->addTimeUnitOption(options, "tu");
    timeUnitBehavior->setTimeUnitStore(&impl_->settings_.impl_->timeUnit);

    options->addOption(SelectionOption("fgroup")
                           .store(&impl_->trajectoryGroup_)
                           .onlySortedAtoms().onlyStatic()
                           .description("Atoms stored in the trajectory file "
                                        "(if not set, assume first N atoms)"));

    // Add plot options.
    settings.impl_->plotSettings.initOptions(options);

    // Add common options for trajectory processing.
    if (!settings.hasFlag(TrajectoryAnalysisSettings::efNoUserRmPBC))
    {
        options->addOption(BooleanOption("rmpbc").store(&settings.impl_->bRmPBC)
                               .description("Make molecules whole for each frame"));
    }
    if (!settings.hasFlag(TrajectoryAnalysisSettings::efNoUserPBC))
    {
        options->addOption(BooleanOption("pbc").store(&settings.impl_->bPBC)
                               .description("Use periodic boundary conditions for distance calculation"));
    }
}