本文整理汇总了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;
}
示例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())]);
}
}
}
示例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);
}
示例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);
}