Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,5 @@ External code/libraries bundled with CPPTRAJ
* The code for quaternion RMSD calculation was adapted from code in [qcprot.c](https://theobald.brandeis.edu/qcp/qcprot.c) originally written by Douglas L. Theobald and Pu Lio (Brandeis University).

* The code for reading numpy arrays in `src/libnpy` is from [libnpy](https://github.com/llohse/libnpy) written by Leon Merten Lohse et al. (Universität Göttingen).

* The code for reading/writing atom/residue number fields in large PDB files (in `Hybrid36.cpp`) is adapted from code written by Ralf W. Grosse-Kunstleve in the Computational Crystallography Toolbox, https://doi.org/10.1107/S0021889801017824, https://raw.githubusercontent.com/cctbx/cctbx_project/master/iotbx/pdb/hybrid_36_c.c
2 changes: 2 additions & 0 deletions src/Command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include "Exec_Random.h"
#include "Exec_CompareClusters.h"
#include "Exec_ParseTiming.h"
#include "Exec_Flush.h"
// ----- SYSTEM ----------------------------------------------------------------
#include "Exec_System.h"
// ----- COORDS ----------------------------------------------------------------
Expand Down Expand Up @@ -245,6 +246,7 @@ void Command::Init() {
Command::AddCmd( new Exec_DataSetCmd(), Cmd::EXE, 1, "dataset" );
Command::AddCmd( new Exec_EnsFileExt(), Cmd::EXE, 1, "ensextension" );
Command::AddCmd( new Exec_Flatten(), Cmd::EXE, 1, "flatten" );
Command::AddCmd( new Exec_Flush(), Cmd::EXE, 1, "flush" );
Command::AddCmd( new Exec_GenerateAmberRst(),Cmd::EXE, 1, "rst" );
Command::AddCmd( new Exec_Help(), Cmd::EXE, 1, "help" );
Command::AddCmd( new Exec_ListAll(), Cmd::EXE, 1, "list" );
Expand Down
11 changes: 11 additions & 0 deletions src/DataFileList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,17 @@ void DataFileList::List() const {
}
}

/** Call write for all data files. and close out and clear all CpptrajFiles. */
void DataFileList::Flush() {
WriteAllDF();
for (CFarray::iterator it = cfList_.begin(); it != cfList_.end(); ++it) {
(*it)->CloseFile();
delete *it;
}
cfList_.clear();
cfData_.clear();
}

// DataFileList::WriteAllDF()
/** Call write for all DataFiles in list for which writeFile is true. Once
* a file has been written set writeFile to false; it can be reset to
Expand Down
2 changes: 2 additions & 0 deletions src/DataFileList.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ class DataFileList {
void List() const;
/// Write all DataFiles in list that have not yet been written.
void WriteAllDF();
/// Write all DataFiles and close out all CpptrajFiles
void Flush();
/// \return true if DataFiles have not yet been written.
bool UnwrittenData() const;
/// Reset the write status of all DataFiles so they will be written
Expand Down
15 changes: 15 additions & 0 deletions src/Exec_Flush.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "Exec_Flush.h"
#include "CpptrajStdio.h"

// Exec_Flush::Help()
void Exec_Flush::Help() const
{
mprintf(" Write any pending data files; close all other files.\n");
}

// Exec_Flush::Execute()
Exec::RetType Exec_Flush::Execute(CpptrajState& State, ArgList& argIn)
{
State.DFL().Flush();
return CpptrajState::OK;
}
12 changes: 12 additions & 0 deletions src/Exec_Flush.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef INC_EXEC_FLUSH_H
#define INC_EXEC_FLUSH_H
#include "Exec.h"
/// <Enter description of Exec_Flush here>
class Exec_Flush : public Exec {
public:
Exec_Flush() : Exec(GENERAL) {}
void Help() const;
DispatchObject* Alloc() const { return (DispatchObject*)new Exec_Flush(); }
RetType Execute(CpptrajState&, ArgList&);
};
#endif
Loading
Loading