PDB export hook

class mdk::ExportPDB : public mdk::Hook, private mdk::SimulVar

The hook for exporting current positions of the residues to a PDB file. The positions are stored as MODELs within the PDB file; (at this moment) the file is output only after the resolution of the simulation, i.e. in the destructor. Also, at the moment only the positions (and not for example REMARKs with QA stats or contacts) are saved.

Public Functions

inline explicit ExportPDB(std::filesystem::path modelPath, double period = 1000.0 * microsecond)

Construct a ExportPDB hook with a model path and the period.

Parameters
  • modelPath – Path to the file to which to output the positions.

  • period – Span between consecutive exports.

~ExportPDB()

This destructor saves the to the file.

virtual void bind(Simulation &simulation) override

Bind the hook to the simulation. Also, fetch the state.

Parameters

simulationSimulation to bind to.

virtual void execute(int step_nr) override

Execute the hook, i.e. check if the span since the last time the positions were exported is greater than period and if it is, export the positions and set the last time to current time.

Parameters

step_nr – Number of the step of the simulation when the hook is invoked.

Private Members

Model base

Reference model to export the current positions to.

pdb::Data data

A PDB data object containing the currently stored records (in particular the positions).

int modelIdx = 1

Current model serial number (1-indexed).

State const *state = nullptr

Const pointer to the state.

std::filesystem::path modelPath

Path to the PDB file.

double period

Span betwen consecutive exports (in internal time).

double tprev = std::numeric_limits<double>::lowest()

Time point when the record was last exported (in internal time). This one is initialized to minimum value so that the first execution always exports.