Closed MartinSalinas98 closed 1 year ago
The documentation for libcifpp is a bit lacking at the moment, I agree.
What you want to accomplish is certainly possible. The classes in libcifpp try to implement common C++ interface for manipulating data. cif::file e.g. inherits from std::list and thus offers all the methods from that class, so you can insert, delete and iterate datatblocks among others.
cif::datablock is also a std::list. Of cif::categories in this case.
cif::category tries to implement the Container requirements as well as the SequenceContainer requirements. That means it looks a bit like a std::vector.
Inserting is done most effectively using the emplace methods.
You could have a look at the file test/unit-v2-test.cpp. This unit test contains many small functions that test various ways you can create and manipulate data objects in cif files. You can also look at the other projects in the PDB-REDO space. All of them are using libcifpp to read and or write cif data.
I will try to create proper documentation. Once I find the time to do so.
Hey there!
I have been trying to use this library for some days now to read and write from and on cif files, and I was wondering if it was possible to manually create and insert data into datablocks.
In my use case, I need to write a datablock to a file, but I need to modify the elements in the
atom_site
tag before actually writing the data with an updated version of those atoms i receive from elsewhere in a different format.I have been taking a look at the source files, but I haven't quite figured out yet a way to do that.
Would it be possible to add an new file to the examples that manually creates a datablock based on a small (can be hardcoded, it doesn't matter) atom dataset?
Thanks!