本文整理汇总了C++中Topology::SetAtom方法的典型用法代码示例。如果您正苦于以下问题:C++ Topology::SetAtom方法的具体用法?C++ Topology::SetAtom怎么用?C++ Topology::SetAtom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Topology
的用法示例。
在下文中一共展示了Topology::SetAtom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteCutFrame
/** Write file containing only cut atoms and energies as charges. */
int Action_Pairwise::WriteCutFrame(int frameNum, Topology const& Parm, AtomMask const& CutMask,
Darray const& CutCharges,
Frame const& frame, std::string const& outfilename)
{
if (CutMask.Nselected() != (int)CutCharges.size()) {
mprinterr("Error: WriteCutFrame: # of charges (%u) != # mask atoms (%i)\n",
CutCharges.size(), CutMask.Nselected());
return 1;
}
Frame CutFrame(frame, CutMask);
Topology* CutParm = Parm.modifyStateByMask( CutMask );
if (CutParm == 0) return 1;
// Set new charges
for (int i = 0; i != CutParm->Natom(); i++)
CutParm->SetAtom(i).SetCharge( CutCharges[i] );
int err = 0;
Trajout_Single tout;
if (tout.PrepareTrajWrite(outfilename, "multi", CutParm, CoordinateInfo(), 1,
TrajectoryFile::MOL2FILE))
{
mprinterr("Error: Could not set up cut mol2 file %s\n", outfilename.c_str());
err = 1;
} else {
tout.WriteSingle(frameNum, CutFrame);
tout.EndTraj();
}
delete CutParm;
return err;
}