本文整理汇总了C++中Molecule::clone方法的典型用法代码示例。如果您正苦于以下问题:C++ Molecule::clone方法的具体用法?C++ Molecule::clone怎么用?C++ Molecule::clone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Molecule
的用法示例。
在下文中一共展示了Molecule::clone方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Molecule
MoleculeIter::SourceRGroups::SourceRGroups(const MoleculeIter &m) {
Array<int> fs;
m._at.dump(fs);
MultiMap<int, int> rgroup2fragment;
RedBlackMap<Fragment, int> fragment2count;
for (auto i = 0; i < fs.size(); i++) {
auto x = m._parent._fragment_coordinates(i, fs[i]);
if (rgroup2fragment.find(x.rgroup, x.fragment)) {
int count = fragment2count.at(x);
fragment2count.remove(x);
fragment2count.insert(x, count + 1);
} else {
rgroup2fragment.insert(x.rgroup, x.fragment);
fragment2count.insert(x, 1);
}
}
const RedBlackSet<int> &rgroups = rgroup2fragment.keys();
for (auto i = rgroups.begin(); i != rgroups.end(); i = rgroups.next(i)) {
auto r = rgroups.key(i);
RGroup &rgroup = _rgroups.push();
RGroup &source = m._parent._rgroups.getRGroup(r);
const RedBlackSet<int> &fs_r = rgroup2fragment[r];
for (auto j = fs_r.begin(); j != fs_r.end(); j = fs_r.next(j)) {
auto f = fs_r.key(j);
for (auto k = 0; k < fragment2count.at({r,f}); k++) {
Molecule *fragment = new Molecule();
fragment->clone(*source.fragments[f], nullptr, nullptr);
fragment->removeAttachmentPoints();
rgroup.fragments.add(fragment);
}
}
}
}
示例2: constructMolecule
void LayeredMolecules::constructMolecule(Molecule &molecule, int layer, bool aromatized) const
{
molecule.clone(const_cast<Molecule&>(_proto), NULL, NULL);
molecule.clearXyz();
for (auto i : const_cast<Molecule&>(_proto).edges())
{
int order = BOND_ZERO;
_bond_masks[BOND_SINGLE][i].get(layer)? order = BOND_SINGLE: 0;
_bond_masks[BOND_DOUBLE][i].get(layer)? order = BOND_DOUBLE: 0;
_bond_masks[BOND_TRIPLE][i].get(layer)? order = BOND_TRIPLE: 0;
molecule.setBondOrder(i, order);
}
for (auto i : const_cast<Molecule&>(_proto).vertices())
{
molecule.setAtomCharge(i, const_cast<Molecule&>(_proto).getAtomCharge(i));
}
// Actually I would prefer to aromatize the molecule manually (and much more effective) as far as I have the list of aromatic bonds already.
// But I don't have any approprite molecule API to do it effectively... :(
if(aromatized)
molecule.aromatize(AromaticityOptions());
}
示例3: decorate
void MoleculeRGroupsComposition::decorate(const Array<int> &fs, Molecule &mol) const {
mol.clone(_mol, nullptr, nullptr);
for (int i = 0; i < fs.size(); i++) {
BaseMolecule &fragment = _fragment(i, fs[i]);
int rsite = _rsite2vertex.at(i);
int apcount = fragment.attachmentPointCount();
int apoint = fragment.getAttachmentPoint(apcount, 0);
Array<int> map;
mol.mergeWithMolecule(fragment, &map);
int atom = mol.getAtomNumber(map[apoint]);
if (mol.mergeAtoms(rsite, map[apoint]) == rsite) {
mol.resetAtom(rsite, atom);
}
}
mol.removeAttachmentPoints();
mol.rgroups.clear();
}
示例4: loadMolecule
//.........这里部分代码省略.........
atom_flags->push(_atoms[i].flags);
}
if (bond_flags != 0)
{
bond_flags->clear();
for (i = 0; i < _bonds.size(); i++)
bond_flags->push(_bonds[i].flags);
}
if (!skip_cistrans)
{
for (i = 0; i < _bonds.size(); i++)
{
if (_bonds[i].cis_trans != 0)
{
int parity = _bonds[i].cis_trans;
if (parity > 0)
mol.cis_trans.setParity(i, _bonds[i].cis_trans);
else
mol.cis_trans.ignore(i);
mol.cis_trans.restoreSubstituents(i);
}
}
}
if (!skip_valence)
{
for (i = 0; i < _atoms.size(); i++)
{
if (_atoms[i].valence >= 0)
mol.setValence(i, _atoms[i].valence);
}
}
if (!skip_stereocenters)
{
for (i = 0; i < _atoms.size(); i++)
{
if (_atoms[i].stereo_type != 0)
mol.stereocenters.add(i, _atoms[i].stereo_type, _atoms[i].stereo_group, _atoms[i].stereo_invert_pyramid);
}
}
for (i = 0; i < _atoms.size(); i++)
{
if (_atoms[i].allene_stereo_parity != 0)
{
int left, right, subst[4];
bool pure_h[4];
int parity = _atoms[i].allene_stereo_parity;
int tmp;
if (!MoleculeAlleneStereo::possibleCenter(mol, i, left, right, subst, pure_h))
throw Error("invalid molecule allene stereo marker");
if (subst[1] != -1 && subst[1] < subst[0])
__swap(subst[1], subst[0], tmp);
if (subst[3] != -1 && subst[3] < subst[2])
__swap(subst[3], subst[2], tmp);
if (pure_h[0])
{
__swap(subst[1], subst[0], tmp);
parity = 3 - parity;
}
if (pure_h[2])
{
__swap(subst[2], subst[3], tmp);
parity = 3 - parity;
}
mol.allene_stereo.add(i, left, right, subst, parity);
}
}
// for loadXyz()
_mol = &mol;
// Check if atom mapping was used
if (has_mapping)
{
// Compute inv_atom_mapping_to_restore
inv_atom_mapping_to_restore.clear_resize(atom_mapping_to_restore.size());
for (int i = 0; i < atom_mapping_to_restore.size(); i++)
inv_atom_mapping_to_restore[atom_mapping_to_restore[i]] = i;
// Compute inv_bond_mapping_to_restore
inv_bond_mapping_to_restore.clear_resize(bond_mapping_to_restore.size());
for (int i = 0; i < bond_mapping_to_restore.size(); i++)
inv_bond_mapping_to_restore[bond_mapping_to_restore[i]] = i;
QS_DEF(Molecule, tmp);
tmp.makeEdgeSubmolecule(mol, atom_mapping_to_restore, bond_mapping_to_restore, NULL);
mol.clone(tmp, NULL, NULL);
}
}