2#ifndef STORMM_NML_FILES_H
3#define STORMM_NML_FILES_H
8#include "Constants/behavior.h"
9#include "Parsing/textfile.h"
10#include "Trajectory/trajectory_enumerators.h"
12#include "namelist_emulator.h"
17using constants::ExceptionResponse;
18using constants::ModificationPolicy;
19using parse::WrapTextSearch;
20using trajectory::CoordinateFileKind;
21using trajectory::TrajectoryFusion;
26constexpr bool default_filecon_read_all_free =
false;
27constexpr char default_filecon_topology_name[] =
"prmtop";
28constexpr char default_filecon_coordinate_name[] =
"inpcrd";
29constexpr char default_filecon_report_name[] =
"md.out";
30constexpr char default_filecon_trajectory_name[] =
"md.crd";
31constexpr char default_filecon_checkpoint_name[] =
"md.rst";
32constexpr char default_filecon_warnings_name[] =
"warn.out";
33constexpr char default_filecon_errors_name[] =
"err.out";
34constexpr char default_filecon_result_fusion[] =
"AUTO";
35constexpr char default_filecon_sdf_mod_policy[] =
"NO";
36constexpr char default_filecon_sdf_notification[] =
"WARN";
37constexpr CoordinateFileKind default_filecon_inpcrd_type = CoordinateFileKind::UNKNOWN;
38constexpr CoordinateFileKind default_filecon_outcrd_type = CoordinateFileKind::AMBER_CRD;
39constexpr CoordinateFileKind default_filecon_chkcrd_type = CoordinateFileKind::AMBER_ASCII_RST;
40constexpr char default_filecon_inpcrd_type_name[] =
"AMBER_INPCRD";
41constexpr char default_filecon_outcrd_type_name[] =
"AMBER_CRD";
42constexpr char default_filecon_chkcrd_type_name[] =
"AMBER_ASCII_RST";
73 MoleculeSystem(
const std::string &topology_file_in,
const std::string &coordinate_file_in,
74 const std::string &trajectory_file_in,
const std::string &checkpoint_file_in,
75 const std::string &label_in,
int frame_start_in,
int frame_end_in,
76 int replica_count_in, CoordinateFileKind coordinate_kind_in,
77 CoordinateFileKind trajectory_kind_in, CoordinateFileKind checkpoint_kind_in);
102 const std::string&
getLabel()
const;
207 std::string topology_file_name;
208 std::string coordinate_file_name;
209 std::string coordinate_output_name;
212 std::string checkpoint_name;
221 CoordinateFileKind coordinate_kind;
222 CoordinateFileKind trajectory_kind;
223 CoordinateFileKind checkpoint_kind;
262 FilesControls(ExceptionResponse policy_in = ExceptionResponse::DIE,
263 WrapTextSearch wrap = WrapTextSearch::NO);
265 ExceptionResponse policy_in = ExceptionResponse::DIE,
266 WrapTextSearch wrap = WrapTextSearch::NO,
267 const std::vector<std::string> &alternatives = {},
268 const std::vector<std::string> &sys_requirements = {
"-pe",
"-ce"});
316 std::vector<std::string> getFreeTopologyNames()
const;
328 std::vector<std::string> getFreeCoordinateNames()
const;
477 ExceptionResponse policy;
485 int free_topology_count;
487 int free_coordinate_count;
490 bool all_free_frames;
492 TrajectoryFusion fuse_files;
496 CoordinateFileKind coordinate_input_format;
499 CoordinateFileKind coordinate_output_format;
502 CoordinateFileKind coordinate_checkpoint_format;
507 std::vector<std::string> topology_file_names;
514 std::vector<std::string> coordinate_file_names;
520 std::vector<MoleculeSystem> systems;
524 std::string report_file;
528 std::string input_transcript_file;
538 std::string coordinate_output_name;
542 std::string checkpoint_name;
545 std::string warning_file_name;
549 ModificationPolicy sdf_mod_policy;
553 ExceptionResponse sdf_mod_alert;
586filesInput(
const TextFile &tf,
int *start_line,
bool *found,
587 const std::vector<KeyRequirement> &sys_keyword_reqs,
588 ExceptionResponse policy = ExceptionResponse::DIE,
589 WrapTextSearch wrap = WrapTextSearch::NO,
590 CoordinateFileKind crd_input_format = default_filecon_inpcrd_type,
591 CoordinateFileKind crd_output_format = default_filecon_outcrd_type,
592 CoordinateFileKind crd_checkpoint_format = default_filecon_chkcrd_type);
595filesInput(
const TextFile &tf,
int *start_line,
bool *found, ExceptionResponse policy,
596 WrapTextSearch wrap);
int getFreeCoordinatesCount() const
Get the free coordinate file count.
Definition nml_files.cpp:571
void addFreeCoordinateName(const std::string &file_name)
Add a free coordinate file to the list, after checking for its prior existence.
Definition nml_files.cpp:724
void removeSystem(int index, int stretch=1)
Remove entries from the systems array.
Definition nml_files.cpp:765
bool readAllFreeFrames() const
Get the indicator of whether to read all free coordinate files' frames.
Definition nml_files.cpp:581
std::string getCheckpointFileName() const
Get the base name of (coordinate) checkpoint files to write.
Definition nml_files.cpp:641
CoordinateFileKind getOutputCoordinateFormat() const
Get the coordinate (trajectory) file output format.
Definition nml_files.cpp:586
void removeFreeCoordinateName(int index, int stretch=1)
Remove entries from the free coordinates array.
Definition nml_files.cpp:733
void setReportFileName(const std::string &file_name)
Set the report file name.
Definition nml_files.cpp:780
std::string getInputTranscriptFile() const
Get the name of the input transcript file (there is no sander or pmemd equivalent other than the verb...
Definition nml_files.cpp:631
std::string getFreeCoordinateName(int index) const
Get one or more free coordinate file names.
Definition nml_files.cpp:611
void setGeneralCheckpointFileName(const std::string &proto_name)
Set the general (fallback) checkpoint file name.
Definition nml_files.cpp:795
void setWarningFileName(const std::string &file_name)
Set the warning file name.
Definition nml_files.cpp:800
void removeFreeTopologyName(int index, int stretch=1)
Remove entries from the free topologies array.
Definition nml_files.cpp:699
TrajectoryFusion getFileFusionProtocol() const
Get the preferences for fusing output coordinate files.
Definition nml_files.cpp:596
void setSdfModficiationPolicy(ModificationPolicy policy_in)
Set the .sdf output file modification policy.
Definition nml_files.cpp:805
int getStructureCount() const
Get the structure count, based on the number of free coordinate files as well as the number of system...
Definition nml_files.cpp:561
void setOutputCoordinateFormat(const std::string &traj_kind)
Set the coordinate (trajectory) file output format.
Definition nml_files.cpp:671
void setInputTranscriptFileName(const std::string &file_name)
Set the input transcript file name.
Definition nml_files.cpp:785
FilesControls(ExceptionResponse policy_in=ExceptionResponse::DIE, WrapTextSearch wrap=WrapTextSearch::NO)
The constructor can prepare an object with default settings or read the corresponding namelist to acc...
Definition nml_files.cpp:192
std::string getTrajectoryFileName() const
Get the base name of trajectory files to write.
Definition nml_files.cpp:636
ModificationPolicy getSdfModificationPolicy() const
Get the policy on modifying .sdf file outputs to conform to the Biovia standard.
Definition nml_files.cpp:651
std::string getFreeTopologyName(int index) const
Get one or more free topology names.
Definition nml_files.cpp:601
FilesControls(const FilesControls &original)=default
As with other control objects, copy and move constructors, plus copy and move assignment operators,...
std::string getWarningFileName() const
Get the name of the file containing warnings printed by the program.
Definition nml_files.cpp:646
CoordinateFileKind getCheckpointFormat() const
Get the coordinate (checkpoint) file output format.
Definition nml_files.cpp:591
void addFreeTopologyName(const std::string &file_name)
Add a free topology to the list, after checking for its prior existence in the list.
Definition nml_files.cpp:691
std::string getReportFile() const
Get the name of the report file (equivalent to mdout in sander or pmemd)
Definition nml_files.cpp:626
void setAllFreeFrameReading(const bool active)
Set whether to read all frames from each free trajectory (true), or just the first (false).
Definition nml_files.cpp:666
void addSystem(const MoleculeSystem &new_mol)
Add a system to the list.
Definition nml_files.cpp:758
void setGeneralTrajectoryFileName(const std::string &proto_name)
Set the general (fallback) coordinate output file name.
Definition nml_files.cpp:790
void setSdfNotifications(ExceptionResponse policy_in)
Set whether to emit notifications about .sdf output file modifications.
Definition nml_files.cpp:810
void setCheckpointFormat(const std::string &chk_kind)
Set the checkpoint (coordinate) file output format.
Definition nml_files.cpp:681
MoleculeSystem getSystem(int index) const
Get a molecule system from this object's array.
Definition nml_files.cpp:621
const NamelistEmulator & getTranscript() const
Get the original namelist emulator object as a transcript of the user input.
Definition nml_files.cpp:661
int getSystemDefinitionCount() const
Get the number of system specifications made with the -sys keyword.
Definition nml_files.cpp:576
int getFreeTopologyCount() const
Get the free topology count.
Definition nml_files.cpp:566
ExceptionResponse getSdfNotifications() const
Get an indication of whether to alert the user when correcting minor mistakes in ....
Definition nml_files.cpp:656
Object to encapsulate a system, a coupled set of coordinates and a single topology....
Definition nml_files.h:48
MoleculeSystem(const MoleculeSystem &original)=default
This object, containing no const members or pointers to repair, can take the default copy and move co...
int getFinalFrame() const
Get the last frame that this system will read for initial coordinate states.
Definition nml_files.cpp:87
CoordinateFileKind getTrajectoryFileKind() const
Get the type of trajectory file.
Definition nml_files.cpp:107
void setCheckpointFileName(const std::string &file_name)
Set the checkpoint file name.
Definition nml_files.cpp:132
CoordinateFileKind getCheckpointFileKind() const
Get the type of checkpoint file.
Definition nml_files.cpp:112
void setInputCoordinateFileName(const std::string &file_name)
Set the input coordinates file name.
Definition nml_files.cpp:122
const std::string & getTopologyFileName() const
Get the name of the topology file in this system.
Definition nml_files.cpp:57
bool validateTopologyFile() const
Report whether the topology file named in this system is a valid file. This validator is public so th...
Definition nml_files.cpp:182
void setInputCoordinateFileKind(const std::string &kind)
Set the input coordinates file type.
Definition nml_files.cpp:152
CoordinateFileKind getInputCoordinateFileKind() const
Get the type of input coordinate file.
Definition nml_files.cpp:102
void setCheckpointFileKind(const std::string &kind)
Set the checkpoint file type.
Definition nml_files.cpp:172
const std::string & getInputCoordinateFileName() const
Get the name of the input coordinates file.
Definition nml_files.cpp:62
const std::string & getCheckpointFileName() const
Get the name of the checkpoint file to write for this system.
Definition nml_files.cpp:72
void setReplicaCount(int count)
Set the number of replicas.
Definition nml_files.cpp:147
int getTotalFrames() const
Get the total number of frames, thus initial states, that this system expects.
Definition nml_files.cpp:92
void setTopologyFileName(const std::string &file_name)
Set the topology file name. This is useful if pre-allocating an array of MoleculeSystems and then fil...
Definition nml_files.cpp:117
int getStartingFrame() const
Get the starting frame that this system will read for initial coordinate states.
Definition nml_files.cpp:82
const std::string & getLabel() const
Get the assigned label for this system.
Definition nml_files.cpp:77
int getReplicaCount() const
Get the replica count for this system, the number of copies of each initial coordinate frame that it ...
Definition nml_files.cpp:97
bool validateInputCoordinateFile() const
Report whether the input coordinate file named in this system is a valid file.
Definition nml_files.cpp:187
void setFinalFrame(int frame_number)
Set the final frame. This can be necessary if the input coordinates file does not contain the request...
Definition nml_files.cpp:142
void setTrajectoryFileKind(const std::string &kind)
Set the trajectory file type.
Definition nml_files.cpp:162
MoleculeSystem()
The constructor can make a blank system or automatically fill values.
Definition nml_files.cpp:25
const std::string & getTrajectoryFileName() const
Get the name of the trajectory file.
Definition nml_files.cpp:67
void setStartingFrame(int frame_number)
Set the starting frame. This can be necessary if the input coordinates file does not contain the requ...
Definition nml_files.cpp:137
void setTrajectoryFileName(const std::string &file_name)
Set the trajectory file name.
Definition nml_files.cpp:127
Collection of variables to transcribe information contained within a namelist.
Definition namelist_emulator.h:30
Structure for translating a text file into a compact, rapidly parsable vector of characters in CPU RA...
Definition textfile.h:45