#include "gromacs/pbcutil/pbc.h"
#include "gromacs/topology/atomprop.h"
#include "gromacs/topology/ifunc.h"
-#include "gromacs/topology/residuetypes.h"
#include "gromacs/topology/symtab.h"
#include "gromacs/topology/topology.h"
#include "gromacs/utility/coolstuff.h"
return pdbRecordTypeName[enumValue];
}
-#define REMARK_SIM_BOX "REMARK THIS IS A SIMULATION BOX"
-
void gmx_write_pdb_box(FILE* out, PbcType pbcType, const matrix box)
{
real alpha, beta, gamma;
int nindex,
const int index[],
gmx_conect conect,
- bool usePqrFormat)
+ bool usePqrFormat,
+ bool standardCompliantMode)
{
gmx_conect_t* gc = static_cast<gmx_conect_t*>(conect);
PdbRecordType type;
real occup, bfac;
gmx_bool bOccup;
+ if (standardCompliantMode)
+ {
+ fprintf(out, "HEADER GROMACS SIMULATION BOX 01-JAN-00 0000\n");
+ fprintf(out,
+ "TITLE Gromacs simulation box\n"
+ "COMPND MOL_ID: 1; \n"
+ "COMPND 2 MOLECULE: GROMACS SIMULATION BOX; \n"
+ "COMPND 3 CHAIN: A; \n"
+ "SOURCE MOL_ID: 1;\n"
+ "SOURCE 2 SYNTHETIC\n"
+ "KEYWDS GROMACS\n"
+ "EXPDTA PURE PRODUCT OF COMPUTER SIMULATION\n"
+ "AUTHOR GROMACS\n"
+ "REVDAT 1 01-JAN-00 0000 0\n");
+ }
+ else
+ {
+ fprintf(out, "TITLE %s\n", (title && title[0]) ? title : gmx::bromacs().c_str());
+ }
+
- fprintf(out, "TITLE %s\n", (title && title[0]) ? title : gmx::bromacs().c_str());
if (box && ((norm2(box[XX]) != 0.0F) || (norm2(box[YY]) != 0.0F) || (norm2(box[ZZ]) != 0.0F)))
{
gmx_write_pdb_box(out, pbcType, box);
fprintf(out, "MODEL %8d\n", model_nr > 0 ? model_nr : 1);
- ResidueType rt;
+ // Collect last printed values for TER record
+ int lastAtomNumber = 0;
+ std::string lastResName;
+ int lastResNr = 0;
+
for (int ii = 0; ii < nindex; ii++)
{
int i = index[ii];
bfac,
atoms->atom[i].elem);
+ lastAtomNumber = i + 1;
+ lastResName = resnm;
+ lastResNr = resnr;
+
if (atoms->pdbinfo && atoms->pdbinfo[i].bAnisotropic)
{
fprintf(out,
}
}
- fprintf(out, "TER\n");
+ if (standardCompliantMode)
+ {
+ fprintf(out, "TER %5d %4.4s%c%4d\n", lastAtomNumber, lastResName.c_str(), chainid, lastResNr);
+ }
+ else
+ {
+ fprintf(out, "TER\n");
+ }
+
fprintf(out, "ENDMDL\n");
if (nullptr != gc)
atomNumberSet = true;
}
}
- std::string buf;
+ static constexpr size_t sc_maxElementNameLength = 3;
+ static_assert(sizeof(atoms->atom[i].elem) >= sc_maxElementNameLength + 1);
+ std::string element;
if (atomNumberSet)
{
atoms->atom[i].atomnumber = atomnumber;
- buf = aps->elementFromAtomNumber(atomnumber);
+ element = aps->elementFromAtomNumber(atomnumber);
if (debug)
{
fprintf(debug, "Atomnumber for atom '%s' is %d\n", anm, atomnumber);
}
}
- buf.resize(3);
- std::strncpy(atoms->atom[i].elem, buf.c_str(), 4);
+ element.resize(sc_maxElementNameLength);
+ std::strcpy(atoms->atom[i].elem, element.c_str());
}
}