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


C++ Bond::getAtom2方法代码示例

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


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

示例1: GetIndex

/////////////////////////////////////////////////////////////////////////////
// Function:    Constructor
// Purpose:		Creates a bond object from an existing Bond struct
// Input:       A Bond object (passed by ref)
//				A vector of MIAtom structs containing the atoms in the bond
//				A vector of corresponding MIAtom objects to use for the new ptrs
// Output:      None
// Note:		Correspondence between MIAtom is inferred from their bondOrder
//				in the vector containers
/////////////////////////////////////////////////////////////////////////////
Bond::Bond(const Bond &bond,
           const MIAtomList &old_atoms,
           const MIAtomList &new_atoms)
{

    std::string error_message;
    int i1 = GetIndex(static_cast<MIAtom*> (bond.getAtom1()), old_atoms);
    int i2 = GetIndex(static_cast<MIAtom*> (bond.getAtom2()), old_atoms);

    if (i1 < 0 || i2 < 0)
    {
        error_message = "Corrupted bond.";
        throw error_message;
    }

    bondOrder = bond.bondOrder;
    atom1 = new_atoms[i1];
    atom2 = new_atoms[i2];
    type = bond.type;
    stereo = bond.stereo;
    ideal_length = bond.ideal_length;
    tolerance = bond.tolerance;
    dict_include = bond.dict_include;
    isaromatic = bond.isaromatic;
    iscyclic = bond.iscyclic;
    ring_system = bond.ring_system;
    smallest_ring_size = bond.smallest_ring_size;
    smallest_aromatic_ring = bond.smallest_aromatic_ring;
}
开发者ID:SpiritsThief,项目名称:mifit,代码行数:39,代码来源:Bond.cpp

示例2: copyBondOrders

void Bond::copyBondOrders(const std::vector<Bond> &fromBonds, std::vector<Bond> &toBonds)
{
    std::map<std::pair<MIAtom*, MIAtom*>, unsigned char> bondOrders;

    std::vector<Bond>::const_iterator constBondIter;
    for (constBondIter = fromBonds.begin(); constBondIter != fromBonds.end(); ++constBondIter)
    {
        Bond b = *constBondIter;
        if (b.getAtom1() < b.getAtom2())
        {
            bondOrders[std::make_pair(b.getAtom1(), b.getAtom2())] = b.getOrder();
        }
        else
        {
            bondOrders[std::make_pair(b.getAtom2(), b.getAtom1())] = b.getOrder();
        }
    }

    std::vector<Bond>::iterator bondIter;
    for (bondIter = toBonds.begin(); bondIter != toBonds.end(); ++bondIter)
    {
        Bond b = *bondIter;
        if (b.getAtom1() < b.getAtom2())
        {
            bondIter->setOrder(bondOrders[std::make_pair(b.getAtom1(), b.getAtom2())]);
        }
        else
        {
            bondIter->setOrder(bondOrders[std::make_pair(b.getAtom2(), b.getAtom1())]);
        }
    }

}
开发者ID:SpiritsThief,项目名称:mifit,代码行数:33,代码来源:Bond.cpp

示例3: WriteBond

void XMLArchive::WriteBond(Bond &hbond)
{
    /* write an hbond */
    calc_indent();
    f = format("%s<Bond atom1=\"%d\" atom2=\"%d\" type=\"%d\" />\n", indent, (int)hbond.getAtom1()->atomnumber(), (int)hbond.getAtom2()->atomnumber(), (int)hbond.type);
    Write(f);
}
开发者ID:SpiritsThief,项目名称:mifit,代码行数:7,代码来源:xmlarchive.cpp

示例4: WriteConnect

void XMLArchive::WriteConnect(Bond &bond)
{
    /* write a connect */
    calc_indent();
    f = format("%s<Connect atom1=\"%d\" atom2=\"%d\" />\n", indent, (int)bond.getAtom1()->atomnumber(), (int)bond.getAtom2()->atomnumber());
    Write(f);
}
开发者ID:SpiritsThief,项目名称:mifit,代码行数:7,代码来源:xmlarchive.cpp


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