本文整理汇总了C++中Topology::Pindex方法的典型用法代码示例。如果您正苦于以下问题:C++ Topology::Pindex方法的具体用法?C++ Topology::Pindex怎么用?C++ Topology::Pindex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Topology
的用法示例。
在下文中一共展示了Topology::Pindex方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteTopology
// ParmFile::WriteTopology()
int ParmFile::WriteTopology(Topology const& Top, FileName const& fnameIn,
ArgList const& argListIn, ParmFormatType fmtIn, int debugIn)
{
parmName_ = fnameIn;
ArgList argIn = argListIn;
ParmFormatType fmt = fmtIn;
if (fmt == UNKNOWN_PARM) {
// Check arg list to see if format specified.
fmt = (ParmFormatType)FileTypes::GetFormatFromArg(PF_KeyArray, argIn, UNKNOWN_PARM);
// If still UNKNOWN check file extension. Default to AMBERPARM
if (fmt == UNKNOWN_PARM)
fmt = (ParmFormatType)FileTypes::GetTypeFromExtension(PF_KeyArray, parmName_.Ext(),
AMBERPARM);
}
ParmIO* parmio = (ParmIO*)FileTypes::AllocIO(PF_AllocArray, fmt, true);
if (parmio == 0) return 1;
parmio->SetDebug( debugIn );
parmio->processWriteArgs( argIn );
mprintf("\tWriting topology %i (%s) to '%s' with format %s\n", Top.Pindex(),
Top.c_str(), parmName_.full(), FileTypes::FormatDescription(PF_AllocArray, fmt));
int err = parmio->WriteParm( parmName_.Full(), Top );
delete parmio;
if (err != 0 ) {
mprinterr("Error: writing topology file '%s'\n", parmName_.full());
return 1;
}
return 0;
}
示例2: Execute
Exec::RetType Exec_ParmBox::Execute(CpptrajState& State, ArgList& argIn) {
Box pbox;
bool nobox = false;
if ( argIn.hasKey("nobox") )
nobox = true;
else {
pbox.SetX( argIn.getKeyDouble("x",0) );
pbox.SetY( argIn.getKeyDouble("y",0) );
pbox.SetZ( argIn.getKeyDouble("z",0) );
pbox.SetAlpha( argIn.getKeyDouble("alpha",0) );
pbox.SetBeta( argIn.getKeyDouble("beta",0) );
pbox.SetGamma( argIn.getKeyDouble("gamma",0) );
}
Topology* parm = State.DSL().GetTopByIndex( argIn );
if (parm == 0) return CpptrajState::ERR;
if (nobox)
mprintf("\tRemoving box information from parm %i:%s\n", parm->Pindex(), parm->c_str());
else
// Fill in missing parm box information from specified parm
pbox.SetMissingInfo( parm->ParmBox() );
if (argIn.hasKey("truncoct")) pbox.SetTruncOct();
parm->SetParmBox( pbox );
parm->ParmBox().PrintInfo();
return CpptrajState::OK;
}
示例3: Init
Action::RetType Action_CreateCrd::Init(ArgList& actionArgs, ActionInit& init, int debugIn)
{
// Keywords
Topology* parm = init.DSL().GetTopology( actionArgs );
if (parm == 0) {
mprinterr("Error: createcrd: No parm files loaded.\n");
return Action::ERR;
}
pindex_ = parm->Pindex();
check_ = !actionArgs.hasKey("nocheck");
// DataSet
std::string setname = actionArgs.GetStringNext();
if (setname == "_DEFAULTCRD_") {
// Special case: Creation of COORDS DataSet has been requested by an
// analysis and should already be present.
coords_ = (DataSet_Coords_CRD*)init.DSL().FindSetOfType(setname, DataSet::COORDS);
} else
coords_ = (DataSet_Coords_CRD*)init.DSL().AddSet(DataSet::COORDS, setname, "CRD");
if (coords_ == 0) return Action::ERR;
// Do not set topology here since it may be modified later.
mprintf(" CREATECRD: Saving coordinates from Top %s to \"%s\"\n",
parm->c_str(), coords_->legend());
if (!check_)
mprintf("\tNot strictly enforcing that all frames have same # atoms.\n");
# ifdef MPI
if (init.TrajComm().Size() > 1)
mprintf("Warning: Synchronization of COORDS data sets over multiple threads is\n"
"Warning: experimental and may be slower than reading in via a single\n"
"Warning: thread. Users are encouraged to run benchmarks before\n"
"Warning: extensive usage.\n");
# endif
return Action::OK;
}