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


C++ Transforms::setBondDistance方法代码示例

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


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

示例1: main

int main(int argc,char *argv[]) {

    // store start time
    time(&start_time);

    cout << "Start: " << ctime(&start_time);
    cout << "Program: " << programName << endl;
    cout << "Program description: " << programDescription << endl;
    cout << "Program author: " << programAuthor << endl;
    cout << "Program version: " << programVersion << " " << programDate << endl;
    cout << "MSL version: " << mslVersion << " " << mslDate << endl;
    /******************************************************************************
     *                          === SETTINGS THE DEFAULTS ===
     *
     *  Put here the defaults for some options that are
     *  not always required
     ******************************************************************************/
    Options defaults; // currently none


    /******************************************************************************
     *                             === OPTION PARSING ===
     *
     *  Parse the command line (and possibly input file)
     *  options. It will also create an input file based
     *  on the current options in the output directory
     *  that can be used to re-run the program with the same
     *  configuration
     ******************************************************************************/
    Options opt = parseOptions(argc, argv, defaults);
    if (opt.errorFlag) {
        cerr << endl;
        cerr << "The program terminated with errors:" << endl;
        cerr << endl;
        cerr << opt.errorMessages << endl;
        cerr << endl;
        cerr << opt.OPerrors << endl;

        //printErrors(opt);
        usage();
        exit(1);
    }
    System sys;
    if (!sys.readPdb(opt.pdb)) {
        cerr << "ERROR: Cannot read pdb file " << opt.pdb << endl;
        exit(1);
    }
    cout << endl;
    cout << "Read pdb file " << opt.pdb << endl;

    AtomBondBuilder abb;
    abb.buildConnections(sys.getAtomPointers());

    Transforms T;
    cout << endl;
    for (unsigned int i=0; i<opt.edits.size(); i++) {
        if (opt.edits[i].type == "bond") {
            if (opt.edits[i].atomNames.size() != 2) {
                cerr << "ERROR: Type bond requires 2 atom name" << endl;
                exit(1);
            }
            Atom * pAtom1 = NULL;
            if (sys.atomExists(opt.edits[i].atomNames[0])) {
                pAtom1 = &(sys.getLastFoundAtom());
            } else {
                cout << "ERROR: Atom " << opt.edits[i].atomNames[0] << " not found" << endl;
                exit(1);
            }
            Atom * pAtom2 = NULL;
            if (sys.atomExists(opt.edits[i].atomNames[1])) {
                pAtom2 = &(sys.getLastFoundAtom());
            } else {
                cout << "ERROR: Atom " << opt.edits[i].atomNames[1] << " not found" << endl;
                exit(1);
            }
            T.setBondDistance(*pAtom1, *pAtom2, opt.edits[i].value);
            cout << i+1 << " Set bond [" << opt.edits[i].atomNames[0] << ", " << opt.edits[i].atomNames[1] << "] to " << opt.edits[i].value << " (" << pAtom1->distance(*pAtom2) << ")" << endl;
        } else if (opt.edits[i].type == "angle") {
            if (opt.edits[i].atomNames.size() != 3) {
                cerr << "ERROR: Type angle requires 3 atom name" << endl;
                exit(1);
            }
            Atom * pAtom1 = NULL;
            if (sys.atomExists(opt.edits[i].atomNames[0])) {
                pAtom1 = &(sys.getLastFoundAtom());
            } else {
                cout << "ERROR: Atom " << opt.edits[i].atomNames[0] << " not found" << endl;
                exit(1);
            }
            Atom * pAtom2 = NULL;
            if (sys.atomExists(opt.edits[i].atomNames[1])) {
                pAtom2 = &(sys.getLastFoundAtom());
            } else {
                cout << "ERROR: Atom " << opt.edits[i].atomNames[1] << " not found" << endl;
                exit(1);
            }
            Atom * pAtom3 = NULL;
            if (sys.atomExists(opt.edits[i].atomNames[2])) {
                pAtom3 = &(sys.getLastFoundAtom());
            } else {
//.........这里部分代码省略.........
开发者ID:Suncuss,项目名称:mslib,代码行数:101,代码来源:setConformation.cpp


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