From 596fb45ef7649fb11d933c86202317eb6e20db1b Mon Sep 17 00:00:00 2001 From: Xavier Robin <xavier.robin@unibas.ch> Date: Mon, 22 Jul 2024 17:49:09 +0200 Subject: [PATCH] fix: fill header line This commit adds the second header line. While this line can be substituted for a blank line per specification, its absence triggers a warning in RDKit about the missing 3D dimension tag. --- modules/io/src/mol/sdf_writer.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/io/src/mol/sdf_writer.cc b/modules/io/src/mol/sdf_writer.cc index e9fd0ded4..e270049f4 100644 --- a/modules/io/src/mol/sdf_writer.cc +++ b/modules/io/src/mol/sdf_writer.cc @@ -22,6 +22,7 @@ #include "sdf_writer.hh" +#include <time.h> #include <ost/boost_filesystem_helper.hh> #include <ost/mol/atom_view.hh> #include <ost/mol/residue_view.hh> @@ -251,8 +252,19 @@ bool SDFWriter::VisitChain(const mol::ChainView& chain) { } // print header lines + // line 1: molecule name ostr_ << cname << std::endl; - ostr_ << std::endl; + // line 2: program name and time + // IIPPPPPPPPMMDDYYHHmmddSSssssssssssEEEEEEEEEEEERRRRRR + std::time_t t = std::time(nullptr); + std::tm tm = *std::localtime(&t); + ostr_ << " " // User's first and last initials + << " OST" // program name + << std::put_time(&tm, "%m%d%y%H%M") // date/time + << "3D" // dimensional codes + << " " // scaling factors, energy, internal registry number + << std::endl; + // line 3: comment (blank) ostr_ << std::endl; // print counts line ostr_ << format("%3d") % chain.GetAtomCount() -- GitLab