当前位置: 首页>>代码示例>>C++>>正文


C++ OptionParser::getDouble方法代码示例

本文整理汇总了C++中OptionParser::getDouble方法的典型用法代码示例。如果您正苦于以下问题:C++ OptionParser::getDouble方法的具体用法?C++ OptionParser::getDouble怎么用?C++ OptionParser::getDouble使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OptionParser的用法示例。


在下文中一共展示了OptionParser::getDouble方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setupOptions

Options setupOptions(int theArgc, char * theArgv[]){
	Options opt;

	OptionParser OP;

	OP.readArgv(theArgc, theArgv);
	OP.setRequired(opt.required);
	OP.setAllowed(opt.optional);

	if (OP.countOptions() == 0) {
		cout << "Usage:" << endl;
		cout << endl;
		cout << "moveProteinCenter --pdb PDB [--x X --y Y --z Z --sele SELE --outfile OUTFILE]\n";
		exit(0);
	}

	opt.pdb = OP.getString("pdb");
	if (OP.fail()){
		cerr << "Pdb not specified, failing.\n";
		exit(1111);
	}

	opt.x = OP.getDouble("x");
	if (OP.fail()){
		cerr << "Warning, x coordinate set to 0.0\n";
		opt.x = 0.0;
	}

	opt.y = OP.getDouble("y");
	if (OP.fail()){
		cerr << "Warning, y coordinate set to 0.0\n";
		opt.y = 0.0;
	}

	opt.z = OP.getDouble("z");
	if (OP.fail()){
		cerr << "Warning, z coordinate set to 0.0\n";
		opt.z = 0.0;
	}

	opt.sele = OP.getString("sele");
	if (OP.fail()){
		opt.sele = "";
	}

	opt.outfile = OP.getString("outfile");
	if (OP.fail()){
		cerr << "Warning, outfile set to test.pdb" << endl;
		opt.outfile = "test.pdb";
	}

	return opt;
}
开发者ID:Suncuss,项目名称:mslib,代码行数:53,代码来源:moveProteinCenter.cpp

示例2: setupOptions

Options setupOptions(int theArgc, char * theArgv[]){

    // Create the options
    Options opt;
    

    // Parse the options
    OptionParser OP;
    OP.readArgv(theArgc, theArgv);
    OP.setRequired(opt.required);    
    OP.setAllowed(opt.optional);
    //    OP.setShortOptionEquivalent(opt.equivalent);
    OP.setDefaultArguments(opt.defaultArgs); // the default argument is the --configfile option
    OP.autoExtendOptions(); // if you give option "solvat" it will be autocompleted to "solvationfile"


    if (OP.countOptions() == 0){
        cout << "Usage:" << endl;
        cout << endl;
        cout << "pdb PDB"<<endl;
        exit(0);
    }

    opt.pdb = OP.getString("pdb");
    if (OP.fail()){
	    cerr << "ERROR 1111 no pdb file"<<endl;
    }
    
    opt.tol = OP.getDouble("tol");
    if (OP.fail()){
      opt.tol = 1.88;
      cerr << "WARNING tol set to default: "<<opt.tol<<endl;
    }

    opt.interfaceOnly = OP.getBool("interfaceOnly");
    if (OP.fail()){
      opt.interfaceOnly = false;
    }

    opt.atomPair = OP.getString("atomPair");
    if (OP.fail()){
      opt.atomPair = "";
    }
    opt.elementPair = OP.getString("elementPair");
    if (OP.fail()){
      opt.elementPair = "";
    }
    opt.printAll = OP.getBool("printAll");
    if (OP.fail()){
      opt.printAll = false;
    }
    return opt;
}
开发者ID:Suncuss,项目名称:mslib,代码行数:53,代码来源:findClashes.cpp

示例3: parseOptions


//.........这里部分代码省略.........
		opt.cerr_fs = NULL;
	}


	/*****************************************
	 *  CHECK THE GIVEN OPTIONS
	 *****************************************/
	//opt.commandName = OP.getCommandName();
	//if (!OP.checkOptions()) {
	//	opt.errorFlag = true;
	//	opt.disallowed = OP.getDisallowedOptions();
	//	opt.missing = OP.getMissingOptions();
	//	opt.ambiguous = OP.getAmbiguousOptions();
	//	return opt;
	//}
	opt.errorFlag = false;
	opt.warningFlag = false;

	opt.sequence= OP.getString("sequence");
	if (OP.fail()) {
		opt.errorMessages = "sequence not specified";
		opt.errorFlag = true;
	}
	opt.startPos = OP.getStringVector("startPos");
	if (OP.fail()) {
		opt.errorMessages = "startPos not specified";
		opt.errorFlag = true;
	}
	opt.startRegPos = OP.getString("startRegPos");
	if (OP.fail()) {
		opt.errorMessages = "startRegPos not specified";
		opt.errorFlag = true;
	}
	opt.r0_start = OP.getDouble("r0_start");
	if (OP.fail()) {
		opt.errorMessages = "r0 not specified";
		opt.errorFlag = true;
	}
	opt.r0_end = OP.getDouble("r0_end");
	if (OP.fail()) {
		opt.errorMessages = "r0 not specified";
		opt.errorFlag = true;
	}
	opt.r0_step = OP.getDouble("r0_step");
	if (OP.fail()) {
		opt.errorMessages = "r0 not specified";
		opt.errorFlag = true;
	}
	opt.r1_start = OP.getDouble("r1_start");
	if (OP.fail()) {
		opt.errorMessages = "r1 not specified";
		opt.errorFlag = true;
	}
	opt.r1_end = OP.getDouble("r1_end");
	if (OP.fail()) {
		opt.errorMessages = "r1 not specified";
		opt.errorFlag = true;
	}
	opt.r1_step = OP.getDouble("r1_step");
	if (OP.fail()) {
		opt.errorMessages = "r1 not specified";
		opt.errorFlag = true;
	}
	opt.w1_start = OP.getDouble("w1_start");
	if (OP.fail()) {
		opt.errorMessages = "w1 not specified";
开发者ID:Suncuss,项目名称:mslib,代码行数:67,代码来源:coiledCoilBuilder.cpp

示例4: setupOptions

Options setupOptions(int theArgc, char * theArgv[]){
	// Create the options
	Options opt;

	// Parse the options
	OptionParser OP;
	OP.readArgv(theArgc, theArgv);
	OP.setRequired(opt.required);	
	OP.setDefaultArguments(opt.defaultArgs); // the default argument is the --configfile option


	if (OP.countOptions() == 0){
		cout << "Usage: designCheck " << endl;
		cout << endl;
		cout << "\n";
		cout << "pdb PDB\n";
		cout << endl;
		exit(0);
	}

	opt.pdb = OP.getString("pdb");
	if (OP.fail()){
		cerr << "ERROR 1111 no pdb specified."<<endl;
		exit(1111);
	}

	opt.prosite = OP.getString("prosite");
	if (OP.fail()){
	  opt.prosite = SYSENV.getEnv("MSL_PROSITE");
	  if (opt.prosite == "UNDEF"){
	    cerr << "ERROR 1111 prosite undefined"<<endl;
	   exit(1111);
	  } else {
	    cerr << "WARNING prosite defaulted to: "<<opt.prosite<<endl;
	  }
	}
	opt.ref = OP.getString("ref");

	opt.topfile = OP.getString("topfile");
	if (OP.fail()){
	    opt.topfile = SYSENV.getEnv("MSL_CHARMM_TOP");
	    if (opt.topfile == "UNDEF"){
	      cerr << "ERROR 1111 topfile not defined\n";
	      exit(1111);
	    } else {
	      cerr << "WARNING topfile defaulted to: "<<opt.topfile<<endl;
	    }
	}

	opt.parfile = OP.getString("parfile");
	if (OP.fail()){
		opt.parfile = SYSENV.getEnv("MSL_CHARMM_PAR");
		if (opt.parfile == "UNDEF"){
		  cerr << "ERROR 1111 parfile not defined\n";
		  exit(1111);
		}else {
		  cerr << "WARNING parfile defaulted to: "<<opt.parfile<<endl;
		}
	}

	opt.hbondfile = OP.getString("hbondfile");
	if (OP.fail()){
		opt.hbondfile = SYSENV.getEnv("MSL_HBOND_PAR");
		if (opt.hbondfile == "UNDEF"){
		  cerr << "WARNING 1111 hbondfile not defined - not building hydrogen bond interactions\n";
		  opt.hbondfile = "";
		}else {
		  cerr << "WARNING hbondfile defaulted to: "<<opt.hbondfile<<endl;
		}
	}


	opt.baselinefile = OP.getString("baselinefile");
	if (OP.fail()){
		opt.baselinefile = "";
		cerr << "WARNING no baselinefile specified " <<endl;
	}

	opt.dielectric = OP.getDouble("dielectric");
	if (OP.fail()){
	  opt.dielectric = 80;
	}

	opt.distanceDependentElectrostatics = OP.getBool("distanceDependentElectrostatics");
	if (OP.fail()){
	  opt.distanceDependentElectrostatics = false;
	}

	opt.vdwScale = OP.getDouble("vdwScale");
	if (OP.fail()){
	  opt.vdwScale = 1.0;
	}

	opt.cuton = OP.getDouble("cuton");
	if (OP.fail()){
	  opt.cuton = 9.0;
	}
	opt.cutoff = OP.getDouble("cutoff");
	if (OP.fail()){
	  opt.cutoff = 15.0;
//.........这里部分代码省略.........
开发者ID:Suncuss,项目名称:mslib,代码行数:101,代码来源:designCheck.cpp

示例5: parseOptions


//.........这里部分代码省略.........
    if (opt.configfile != "") {
        OP.readFile(opt.configfile);
        if (OP.fail()) {
            opt.errorFlag = true;
            opt.errorMessages += "Cannot read configuration file " + opt.configfile + "\n";
            exit(1);
        }
    }

    /*****************************************
     *  VERSION AND HELP
     *
     *  --version or -v arguments print the version number
     *  --help prints the usage and help
     *****************************************/
    opt.version = OP.getBool("version");
    //if (OP.fail()) {
    //	opt.version = OP.getBool("v");
    //}

    if (opt.version) {
        version();
        exit(0);
    }

    opt.help = OP.getBool("help");
//	if (OP.fail()) {
//		opt.help = OP.getBool("h");
//	}

    if (opt.help) {
        help(defaults);
        exit(0);
    }

    /*****************************************
     *  CHECK THE GIVEN OPTIONS
     *****************************************/
    if (!OP.checkOptions()) {
        opt.errorFlag = true;
        opt.OPerrors = OP.getErrors();
        return opt;
    }
    opt.errorFlag = false;
    opt.warningFlag = false;


    /*****************************************
     *  CHECK THE GIVEN OPTIONS
     *****************************************/
    //opt.commandName = OP.getCommandName();
    //if (!OP.checkOptions()) {
    //	opt.errorFlag = true;
    //	opt.disallowed = OP.getDisallowedOptions();
    //	opt.missing = OP.getMissingOptions();
    //	opt.ambiguous = OP.getAmbiguousOptions();
    //	return opt;
    //}
    opt.errorFlag = false;
    opt.warningFlag = false;


    opt.pdb = OP.getString("pdb");
    if (OP.fail()) {
        opt.errorMessages = "Option name of first pdb file \"pdb\" not specified";
        opt.errorFlag = true;
    }

    opt.outputPdb = OP.getString("outputPdb");
    if (OP.fail()) {
        opt.warningMessages = "Option name of output edited pdb file \"outputPdb\" not specified";
        opt.warningFlag = true;
        string base = MslTools::pathTail(opt.pdb);
        base = MslTools::pathRoot(base);
        opt.outputPdb = base + (string)"-edited.pdb";
    }

    int index = 0;
    while (true) {
        DoF tmp;
        tmp.type = OP.getString("type", index);
        if (OP.fail()) {
            break;
        }
        tmp.atomNames = OP.getStringVector("atomNames", index);
        if (OP.fail()) {
            break;
        }
        tmp.value = OP.getDouble("value", index);
        if (OP.fail()) {
            break;
        }
        opt.edits.push_back(tmp);
        index++;
    }

    // return the Options structure
    return opt;

}
开发者ID:Suncuss,项目名称:mslib,代码行数:101,代码来源:setConformation.cpp

示例6: parseOptions


//.........这里部分代码省略.........
		opt.errorFlag = true;
		opt.OPerrors = OP.getErrors();
		return opt;
	}
	opt.errorFlag = false;
	opt.warningFlag = false;

	/*****************************************
	 *  OUTPUT DIR AND FILES
	 *****************************************/


	/*****************************************
	 *  CHECK THE GIVEN OPTIONS
	 *****************************************/
	opt.errorFlag = false;
	opt.warningFlag = false;

	opt.pdbFile = OP.getString("pdbFile");
	if (OP.fail()) {
		opt.errorMessages = "pdb file not specified";
		opt.errorFlag = true;
	}
	opt.helicalAxisPdbFile = OP.getString("helicalAxisPdbFile");
	if (OP.fail()) {
		opt.errorMessages = "helicalAxisPdbFile file not specified";
		opt.errorFlag = true;
	}
	opt.output = OP.getString("output");
	if (OP.fail()) {
		opt.errorMessages = "output not specified";
		opt.errorFlag = true;
	}
	opt.xShiftStart = OP.getDouble("xShiftStart");
	if (OP.fail()) {
		opt.errorMessages = "xShiftStart not specified";
		opt.errorFlag = true;
	}
	opt.xShiftEnd = OP.getDouble("xShiftEnd");
	if (OP.fail()) {
		opt.errorMessages = "xShiftEnd not specified";
		opt.errorFlag = true;
	}
	opt.xShiftSteps = OP.getDouble("xShiftSteps");
	if (OP.fail()) {
		opt.errorMessages = "xShiftSteps not specified";
		opt.errorFlag = true;
	}

	opt.zShiftAStart = OP.getDouble("zShiftAStart");
	if (OP.fail()) {
		opt.errorMessages = "zShiftAStart not specified";
		opt.errorFlag = true;
	}
	opt.zShiftAEnd = OP.getDouble("zShiftAEnd");
	if (OP.fail()) {
		opt.errorMessages = "zShiftAEnd not specified";
		opt.errorFlag = true;
	}
	opt.zShiftASteps = OP.getDouble("zShiftASteps");
	if (OP.fail()) {
		opt.errorMessages = "zShiftASteps not specified";
		opt.errorFlag = true;
	}

	opt.zShiftBStart = OP.getDouble("zShiftBStart");
开发者ID:Suncuss,项目名称:mslib,代码行数:67,代码来源:genHeteroUniverse.cpp

示例7: setupOptions

Options setupOptions(int theArgc, char * theArgv[]){
	Options opt;

	OptionParser OP;

	OP.readArgv(theArgc, theArgv);
	OP.setRequired(opt.required);
	OP.setAllowed(opt.optional);

	if (OP.countOptions() == 0){
		cout << "Usage:" << endl;
		cout << endl;
		cout << "multiSearchDM --inputPDB PDB --pdbList LIST --searchCriteria SEARCH_STRING --windowSize NUM [ --numberOfIterations NUM --allowIntraChainCompare  --likenessTolernace TOL --alignPdbs --debug ]\n";
		cout << endl<<"\tsearchCriteria can be:\n";
		cout << "\tstandard       - sum of the diff. for every item between two MatrixWindows.\n";
		cout << "\tdiagnol        - sum of the diff. for the diagnol (top left-bottom right) between two MatrixWindows.\n";
		cout << "\tdoubleDiagnol  - sum of the diff. for both diagnols between two MatrixWindows.\n";
		cout << "\tminDistance    - sum of the diff. between the minimal distance for each row,col of the given MatrixWindows.\n";
		cout << "\tminDistanceRow - sum of the diff. between the minimal distance for each row of the given MatrixWindows.\n";
		exit(0);
	}

	opt.inputPDB = OP.getString("inputPDB");
	if (OP.fail()){
		cerr << "ERROR 1111 inputPDB not specified.\n";
		exit(1111);
	}

	opt.pdbList = OP.getString("pdbList");
	if (OP.fail()){
		cerr << "ERROR 1111 pdbList not specified.\n";
		exit(1111);
	}

	opt.searchCriteria = OP.getString("searchCriteria");
	if (OP.fail()){
		cerr <<"ERROR 1111 searchCriteria not specified."<<endl;
		exit(1111);
	}

	opt.windowSize = OP.getInt("windowSize");
	if (OP.fail()){
		cerr << "ERROR 1111 windowSize not specified."<<endl;
		exit(1111);
	}

	opt.numberOfIterations = OP.getInt("numberOfIterations");
	if (OP.fail()){
		opt.numberOfIterations = 1;
	}

	opt.intraChainCompare = OP.getBool("allowIntraChainCompare");
	if (OP.fail()){
		opt.intraChainCompare = false;
	}


	opt.likenessTolerance = OP.getDouble("likenessTolerance");
	if (OP.fail()){
		opt.likenessTolerance = MslTools::doubleMax;
	}

	opt.alignPdbs         = OP.getBool("alignPdbs");
	if (OP.fail()){
		opt.alignPdbs = false;
	}

	opt.rmsdTol   = OP.getDouble("rmsdTol");
	if (OP.fail()) {
		opt.rmsdTol = 2.0;
	}


	opt.debug = OP.getBool("debug");
	if (OP.fail()){
		opt.debug = false;
	}


	return opt;
}
开发者ID:Suncuss,项目名称:mslib,代码行数:81,代码来源:multiSearchDM.withbinary.cpp

示例8: setupOptions

Options setupOptions(int theArgc, char * theArgv[]){
  Options opt;

  OptionParser OP;


  OP.setRequired(opt.required);
  OP.setAllowed(opt.optional);
  OP.setDefaultArguments(opt.defaultArgs); // a pdb file value can be given as a default argument without the --pdbfile option
  OP.autoExtendOptions(); // if you give option "solvat" it will be autocompleted to "solvationfile"
  OP.readArgv(theArgc, theArgv);

  if (OP.countOptions() == 0){
    cout << "Usage:" << endl;
    cout << endl;
    cout << "resurfaceSaltBridges --pdb PDB\n";

    cout << "\nprogram options: "<<endl;
    for (uint i = 0; i < opt.required.size();i++){
      cout <<"R  --"<<opt.required[i]<<"  "<<endl;
    }
    cout <<endl;
    for (uint i = 0; i < opt.optional.size();i++){
      cout <<"O  --"<<opt.optional[i]<<"  "<<endl;
    }
    cout << endl;
    exit(0);
  }



  opt.pdb = OP.getString("pdb");
  if (OP.fail()){
    cerr << "ERROR 1111 pdb not specified.\n";
    exit(1111);
  }
  opt.sb_prop_table = OP.getString("sb_prop_table");
  if (OP.fail()){
    opt.sb_prop_table = SYSENV.getEnv("MSL_SB_PROP_TABLE"); 
    cout << "SB_PROP_TABLE: "<<opt.sb_prop_table<<endl;
    if (opt.sb_prop_table == "UNDEF"){
      std::cerr << "ERROR 1111 no sb_prop_table specified."<<std::endl;	
      exit(1111);
    } else {
      if (MslTools::fileExists(opt.sb_prop_table)){
	cerr << "WARNING sb_prop_table defaulted to: "<<opt.sb_prop_table<<endl;
      } else {
	std::cerr << "ERROR 1111 no sb_prop_table specified and couldn't find default one: "<<opt.sb_prop_table<<std::endl;	
	exit(1111);	
      }
      
    }

  }

  opt.topfile = OP.getString("topfile");
  if (OP.fail()){
    opt.topfile = SYSENV.getEnv("MSL_CHARMM_TOP");
    cerr << "WARNING: charmmtopfile not specified, using " << opt.topfile << "\n";
  }
  if (!MslTools::fileExists(opt.topfile)){
    cerr << "ERROR 1111 CHARMM TOPFILE DOESN'T EXIST: "<<opt.topfile<<endl;
    exit(1111);
  }

  opt.parfile = OP.getString("parfile");
  if (OP.fail()){
    opt.parfile = SYSENV.getEnv("MSL_CHARMM_PAR");
    cerr <<"WARNING charmmparfile not specified, using " << opt.parfile << "\n";

  }
  if (!MslTools::fileExists(opt.parfile)){
    cerr << "ERROR 1111 CHARMM parFILE DOESN'T EXIST: "<<opt.parfile<<endl;
    exit(1111);
  }
  opt.rotlib = OP.getString("rotlib");
  if (OP.fail()){
    opt.rotlib = SYSENV.getEnv("MSL_ROTLIB");
    cerr << "WARNING rotlib not specified, using " << opt.rotlib << "\n";
  }

  if (!MslTools::fileExists(opt.rotlib)){
    cerr << "ERROR 1111 rotamer library DOESN'T EXIST: "<<opt.rotlib<<endl;
    exit(1111);
  }

  opt.numStructuralModels = OP.getInt("numStructuralModels");
  if (OP.fail()){
    opt.numStructuralModels = 10;
  }
  opt.numSequenceModels   = OP.getInt("numSequenceModels");
  if (OP.fail()){
    opt.numSequenceModels = 30;
  }
  opt.numMCcycles  = OP.getInt("numMCcycles");
  if (OP.fail()){
    opt.numMCcycles = 100;
  }
  opt.startMCtemp  = OP.getDouble("startMCtemp");
  if (OP.fail()){
//.........这里部分代码省略.........
开发者ID:Suncuss,项目名称:mslib,代码行数:101,代码来源:resurfaceSaltBridges.cpp


注:本文中的OptionParser::getDouble方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。