本文整理汇总了C++中PDBFile类的典型用法代码示例。如果您正苦于以下问题:C++ PDBFile类的具体用法?C++ PDBFile怎么用?C++ PDBFile使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PDBFile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main () {
//PDBFile pdb ("quartz_100_short.pdb");
PDBFile pdb ("beta-cristobalite.pdb");
// create the quartz unitcell
Molecule * uc = pdb.Molecules(0);
//make copies of the quartz unitcell and shift them around
//VecR x_shift (4.91, 0.0, 0.0);
VecR x_shift (10.0, 0.0, 0.0);
VecR y_shift (0.0, 10.0, 0.0);
VecR z_shift (0.0, 0.0, 0.0);
// Create the slab by creating and shifting copies of the unit cell
Mol_ptr_vec mols = UnitCellToSlab(uc, x_shift, y_shift, z_shift);
Molecule * mol = MakeSingleMolecule (mols);
//AddDanglingHydrogens (mol);
// Take care of renaming the atoms and the residue before printing it out
FixSingleMoleculeNaming (mol);
PrintMoleculePDB (mol);
return 0;
}
示例2: main
int main () {
PDBFile pdb ("temp.pdb");
Molecule * mol = pdb.Molecules(0);
mol->Name("qtz");
std::vector<Atom *> atoms = mol->Atoms();
/* cycle through each atom in order of the pdb file */
RUN (atoms)
{
Atom * atom = atoms[i];
atom->Residue("qtz");
VecR pos = atom->Position();
/* find the surface Oxygens */
if (atom->Name().find("O") != string::npos && pos[z] > -7.9)
{
/* add H's to the surface */
Atom * h = new Atom ("H", pos + VecR (0.0, 0.0, 1.1));
mol->AddAtom(h);
}
}
std::vector<Molecule *> mols;
mols.push_back(mol);
PDBFile::WritePDB(mols);
}
示例3: dumpStreamData
static void dumpStreamData(ScopedPrinter &P, PDBFile &File) {
uint32_t StreamCount = File.getNumStreams();
StringRef DumpStreamStr = opts::DumpStreamData;
uint32_t DumpStreamNum;
if (DumpStreamStr.getAsInteger(/*Radix=*/0U, DumpStreamNum) ||
DumpStreamNum >= StreamCount)
return;
uint32_t StreamBytesRead = 0;
uint32_t StreamSize = File.getStreamByteSize(DumpStreamNum);
auto StreamBlocks = File.getStreamBlockList(DumpStreamNum);
for (uint32_t StreamBlockAddr : StreamBlocks) {
uint32_t BytesLeftToReadInStream = StreamSize - StreamBytesRead;
if (BytesLeftToReadInStream == 0)
break;
uint32_t BytesToReadInBlock = std::min(
BytesLeftToReadInStream, static_cast<uint32_t>(File.getBlockSize()));
auto StreamBlockData =
File.getBlockData(StreamBlockAddr, BytesToReadInBlock);
outs() << StreamBlockData;
StreamBytesRead += StreamBlockData.size();
}
}
示例4: diffAndPrint
static bool diffAndPrint(StringRef Label, PDBFile &File1, PDBFile &File2, T V1,
T V2) {
if (V1 == V2) {
outs() << formatv(" {0}: No differences detected!\n", Label);
return false;
}
outs().indent(2) << Label << "\n";
outs().indent(4) << formatv("{0}: {1}\n", File1.getFilePath(), V1);
outs().indent(4) << formatv("{0}: {1}\n", File2.getFilePath(), V2);
return true;
}
示例5: dumpStreamSizes
static void dumpStreamSizes(ScopedPrinter &P, PDBFile &File) {
if (!opts::DumpStreamSizes)
return;
ListScope L(P, "StreamSizes");
uint32_t StreamCount = File.getNumStreams();
for (uint32_t StreamIdx = 0; StreamIdx < StreamCount; ++StreamIdx) {
std::string Name("Stream ");
Name += to_string(StreamIdx);
P.printNumber(Name, File.getStreamByteSize(StreamIdx));
}
}
示例6: dumpStreamBlocks
static void dumpStreamBlocks(ScopedPrinter &P, PDBFile &File) {
if (!opts::DumpStreamBlocks)
return;
ListScope L(P, "StreamBlocks");
uint32_t StreamCount = File.getNumStreams();
for (uint32_t StreamIdx = 0; StreamIdx < StreamCount; ++StreamIdx) {
std::string Name("Stream ");
Name += to_string(StreamIdx);
auto StreamBlocks = File.getStreamBlockList(StreamIdx);
P.printList(Name, StreamBlocks);
}
}
示例7: dumpNamedStream
static void dumpNamedStream(ScopedPrinter &P, PDBFile &File, StringRef Stream) {
InfoStream &IS = File.getPDBInfoStream();
uint32_t NameStreamIndex = IS.getNamedStreamIndex(Stream);
if (NameStreamIndex != 0) {
std::string Name("Stream '");
Name += Stream;
Name += "'";
DictScope D(P, Name);
P.printNumber("Index", NameStreamIndex);
MappedBlockStream NameStream(NameStreamIndex, File);
StreamReader Reader(NameStream);
NameHashTable NameTable;
NameTable.load(Reader);
P.printHex("Signature", NameTable.getSignature());
P.printNumber("Version", NameTable.getHashVersion());
P.printNumber("Name Count", NameTable.getNameCount());
ListScope L(P, "Names");
for (uint32_t ID : NameTable.name_ids()) {
StringRef Str = NameTable.getStringForID(ID);
if (!Str.empty())
P.printString(Str);
}
}
}
示例8: dumpInfoStream
static void dumpInfoStream(ScopedPrinter &P, PDBFile &File) {
InfoStream &IS = File.getPDBInfoStream();
DictScope D(P, "PDB Stream");
P.printNumber("Version", IS.getVersion());
P.printHex("Signature", IS.getSignature());
P.printNumber("Age", IS.getAge());
P.printObject("Guid", IS.getGuid());
}
示例9: dumpFileHeaders
static void dumpFileHeaders(ScopedPrinter &P, PDBFile &File) {
if (!opts::DumpHeaders)
return;
DictScope D(P, "FileHeaders");
P.printNumber("BlockSize", File.getBlockSize());
P.printNumber("Unknown0", File.getUnknown0());
P.printNumber("NumBlocks", File.getBlockCount());
P.printNumber("NumDirectoryBytes", File.getNumDirectoryBytes());
P.printNumber("Unknown1", File.getUnknown1());
P.printNumber("BlockMapAddr", File.getBlockMapIndex());
P.printNumber("NumDirectoryBlocks", File.getNumDirectoryBlocks());
P.printNumber("BlockMapOffset", File.getBlockMapOffset());
// The directory is not contiguous. Instead, the block map contains a
// contiguous list of block numbers whose contents, when concatenated in
// order, make up the directory.
P.printList("DirectoryBlocks", File.getDirectoryBlockArray());
P.printNumber("NumStreams", File.getNumStreams());
}
示例10: printSymmetricDifferences
static bool printSymmetricDifferences(PDBFile &File1, PDBFile &File2,
T &&OnlyRange1, T &&OnlyRange2,
StringRef Label) {
bool HasDiff = false;
if (!OnlyRange1.empty()) {
HasDiff = true;
outs() << formatv(" {0} {1}(s) only in ({2})\n", OnlyRange1.size(), Label,
File1.getFilePath());
for (const auto &Item : OnlyRange1)
outs() << formatv(" {0}\n", Label, Item);
}
if (!OnlyRange2.empty()) {
HasDiff = true;
outs() << formatv(" {0} {1}(s) only in ({2})\n", OnlyRange2.size(),
File2.getFilePath());
for (const auto &Item : OnlyRange2)
outs() << formatv(" {0}\n", Item);
}
return HasDiff;
}
示例11: main
int main () {
// The unitcell's PDB file - must have a "TER" after the residue
PDBFile pdb ("octadecane.pdb");
string name = "odn";
double spacing = 5.528; // inter-chain spacing
GridParams params (pdb.Molecules(0), name, spacing, 7, 1, 6);
// Create the slab by creating and shifting copies of the unit cell
Mol_ptr_vec mols = UnitCellToSlab(params);
//Molecule * mol = MakeSingleMolecule (params);
//AddDanglingHydrogens (params);
// Take care of renaming the atoms and the residue before printing it out
//FixSingleMoleculeNaming (params);
PrintMoleculesPDB (mols);
return 0;
}
示例12: main
int main () {
PDBFile pdb ("octadecane.pdb");
//MDSystem::Dimensions(VecR(29.868, 100.0, 27.792));
Atom_ptr_vec& atoms = pdb.Atoms();
printf ("!entry.xxx.unit.connectivity table int atom1x int atom2x int flags\n");
/* cycle through each atom in order of the pdb file */
for (int i = 0; i != atoms.size() - 1; i++)
{
for (int j = i+1; j != atoms.size(); j++)
{
//double distance = MDSystem::Distance(atoms[i],atoms[j]).Magnitude();
double distance = (atoms[i]->Position() - atoms[j]->Position()).Magnitude();
if (distance < 1.7)
{
printf (" %d %d 1\n", i+1, j+1);
}
}
}
return 0;
}
示例13: dumpDbiStream
static void dumpDbiStream(ScopedPrinter &P, PDBFile &File) {
DbiStream &DS = File.getPDBDbiStream();
DictScope D(P, "DBI Stream");
P.printNumber("Dbi Version", DS.getDbiVersion());
P.printNumber("Age", DS.getAge());
P.printBoolean("Incremental Linking", DS.isIncrementallyLinked());
P.printBoolean("Has CTypes", DS.hasCTypes());
P.printBoolean("Is Stripped", DS.isStripped());
P.printObject("Machine Type", DS.getMachineType());
P.printNumber("Number of Symbols", DS.getNumberOfSymbols());
uint16_t Major = DS.getBuildMajorVersion();
uint16_t Minor = DS.getBuildMinorVersion();
P.printVersion("Toolchain Version", Major, Minor);
std::string DllName;
raw_string_ostream DllStream(DllName);
DllStream << "mspdb" << Major << Minor << ".dll version";
DllStream.flush();
P.printVersion(DllName, Major, Minor, DS.getPdbDllVersion());
ListScope L(P, "Modules");
for (auto &Modi : DS.modules()) {
DictScope DD(P);
P.printString("Name", Modi.Info.getModuleName());
P.printNumber("Debug Stream Index", Modi.Info.getModuleStreamIndex());
P.printString("Object File Name", Modi.Info.getObjFileName());
P.printNumber("Num Files", Modi.Info.getNumberOfFiles());
P.printNumber("Source File Name Idx", Modi.Info.getSourceFileNameIndex());
P.printNumber("Pdb File Name Idx", Modi.Info.getPdbFilePathNameIndex());
P.printNumber("Line Info Byte Size", Modi.Info.getLineInfoByteSize());
P.printNumber("C13 Line Info Byte Size",
Modi.Info.getC13LineInfoByteSize());
P.printNumber("Symbol Byte Size", Modi.Info.getSymbolDebugInfoByteSize());
P.printNumber("Type Server Index", Modi.Info.getTypeServerIndex());
P.printBoolean("Has EC Info", Modi.Info.hasECInfo());
std::string FileListName =
to_string(Modi.SourceFiles.size()) + " Contributing Source Files";
ListScope LL(P, FileListName);
for (auto File : Modi.SourceFiles)
P.printString(File);
}
}
示例14: dumpTpiStream
static void dumpTpiStream(ScopedPrinter &P, PDBFile &File) {
if (!opts::DumpTypeStream)
return;
DictScope D(P, "Type Info Stream");
TpiStream &Tpi = File.getPDBTpiStream();
P.printNumber("TPI Version", Tpi.getTpiVersion());
P.printNumber("Record count", Tpi.NumTypeRecords());
if (!opts::DumpTpiRecordBytes)
return;
ListScope L(P, "Records");
for (auto &Type : Tpi.types()) {
DictScope DD(P, "");
P.printHex("Kind", unsigned(Type.Leaf));
P.printBinaryBlock("Bytes", Type.LeafData);
}
}
示例15: move
Expected<std::unique_ptr<DbiStream>>
DbiStreamBuilder::build(PDBFile &File, const msf::WritableStream &Buffer) {
if (!VerHeader.hasValue())
return make_error<RawError>(raw_error_code::unspecified,
"Missing DBI Stream Version");
if (auto EC = finalize())
return std::move(EC);
auto StreamData = MappedBlockStream::createIndexedStream(File.getMsfLayout(),
Buffer, StreamDBI);
auto Dbi = llvm::make_unique<DbiStream>(File, std::move(StreamData));
Dbi->Header = Header;
Dbi->FileInfoSubstream = ReadableStreamRef(FileInfoBuffer);
Dbi->ModInfoSubstream = ReadableStreamRef(ModInfoBuffer);
if (auto EC = Dbi->initializeModInfoArray())
return std::move(EC);
if (auto EC = Dbi->initializeFileInfo())
return std::move(EC);
return std::move(Dbi);
}