Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not use "bad" box info from PDB files #1068

Merged
merged 5 commits into from
Mar 7, 2024
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
3 changes: 3 additions & 0 deletions .github/workflows/merge-gate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ jobs:
echo $CONDA/bin >> $GITHUB_PATH
- name: Install conda packages
run: |
which conda
conda install conda=23.11.0 python=3.10
conda --version
conda env update --file devtools/ci/environment.yml --name base
- name: Install cpptraj
run: |
Expand Down
72 changes: 36 additions & 36 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -101,42 +101,42 @@ pipeline {
}
post { cleanup { deleteDir() } }
}
stage("Linux PGI serial build") {
agent {
docker {
// Until we figure out why PGI compilers fail on the master Jenkins node,
// force them to run on Intel CPU slaves
label "pgi && intel-cpu"
image 'ambermd/cpu-build:latest'
alwaysPull true
// Pull the licensed PGI compilers from the host machine (must have
// the compilers installed in /opt/pgi)
args "-v /opt/pgi:/opt/pgi"
}
}

steps {
unstash "source"
script {
try {
sh """#!/bin/sh -ex
unset CUDA_HOME
./configure --with-netcdf --with-fftw3 pgi
make -j6 install
cd test && make test.showerrors
"""
} catch (error) {
echo "PGI BUILD AND/OR TEST FAILED"
try {
pullRequest.comment("The PGI build in Jenkins failed.")
} catch (err2) {
echo "Could not post a PR comment: ${err2}"
}
}
}
}
post { cleanup { deleteDir() } }
}
//stage("Linux PGI serial build") {
// agent {
// docker {
// // Until we figure out why PGI compilers fail on the master Jenkins node,
// // force them to run on Intel CPU slaves
// label "pgi && intel-cpu"
// image 'ambermd/cpu-build:latest'
// alwaysPull true
// // Pull the licensed PGI compilers from the host machine (must have
// // the compilers installed in /opt/pgi)
// args "-v /opt/pgi:/opt/pgi"
// }
// }

// steps {
// unstash "source"
// script {
// try {
// sh """#!/bin/sh -ex
// unset CUDA_HOME
// ./configure --with-netcdf --with-fftw3 pgi
// make -j6 install
// cd test && make test.showerrors
// """
// } catch (error) {
// echo "PGI BUILD AND/OR TEST FAILED"
// try {
// pullRequest.comment("The PGI build in Jenkins failed.")
// } catch (err2) {
// echo "Could not post a PR comment: ${err2}"
// }
// }
// }
// }
// post { cleanup { deleteDir() } }
//}
stage("Linux GNU parallel build") {
agent {
docker {
Expand Down
24 changes: 16 additions & 8 deletions src/PDBfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,24 +483,32 @@ void PDBfile::readCRYST1(double* box) {
}

/** Print a warning to STDOUT if unit cell lengths are strange. */
static inline void box_warning(const double* box) {
if (box[0] == 1.0 && box[1] == 1.0 && box[2] == 1.0)
static inline int box_warning(const double* box) {
if (box[0] == 1.0 && box[1] == 1.0 && box[2] == 1.0) {
mprintf("Warning: PDB cell lengths are all 1.0 Ang.;"
" this usually indicates an invalid box.\n");
return 1;
}
return 0;
}

/** Read box info from CRYST1, verbose. */
void PDBfile::pdb_Box_verbose(double* box) {
/** Read box info from CRYST1, verbose.
* \return 1 if box seems invalid.
*/
int PDBfile::pdb_Box_verbose(double* box) {
readCRYST1(box);
box_warning(box);
int isbadbox = box_warning(box);
mprintf("\tRead CRYST1 info from PDB: a=%g b=%g c=%g alpha=%g beta=%g gamma=%g\n",
box[0], box[1], box[2], box[3], box[4], box[5]);
return isbadbox;
}

/** Read box info from CRYST1, warn only if box is strange looking. */
void PDBfile::pdb_Box_terse(double* box) {
/** Read box info from CRYST1, warn only if box is strange looking.
* \return 1 if box seems invalid.
*/
int PDBfile::pdb_Box_terse(double* box) {
readCRYST1(box);
box_warning(box);
return box_warning(box);
}

/** Read serial #s of atoms from a CONECT record. */
Expand Down
4 changes: 2 additions & 2 deletions src/PDBfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ class PDBfile : public CpptrajFile {
/// Get charge and radius from PQR ATOM/HETATM record.
void pdb_ChargeAndRadius(float&, float&);
/// Set given XYZ array with A/B/C/alpha/beta/gamma from CRYST1 record, verbose.
void pdb_Box_verbose(double*);
int pdb_Box_verbose(double*);
/// Set given XYZ array with A/B/C/alpha/beta/gamma from CRYST1 record, terse.
void pdb_Box_terse(double*);
int pdb_Box_terse(double*);
/// Set given array with atom and #s of bonded atoms from CONECT record.
int pdb_Bonds(int*);
/// \return Link record.
Expand Down
13 changes: 9 additions & 4 deletions src/Traj_PDBfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ int Traj_PDBfile::setupTrajin(FileName const& fname, Topology* trajParm)
if (file_.RecType() == PDBfile::CRYST1) {
// Read in box information
double box_crd[6];
file_.pdb_Box_verbose( box_crd );
if (boxInfo.SetupFromXyzAbg( box_crd )) {
int is_bad_box = file_.pdb_Box_verbose( box_crd );
if (is_bad_box || boxInfo.SetupFromXyzAbg( box_crd )) {
mprintf("Warning: Box information in PDB appears invalid; disabling box.\n");
boxInfo.SetNoBox();
}
Expand Down Expand Up @@ -203,8 +203,13 @@ int Traj_PDBfile::readFrame(int set, Frame& frameIn)
// Skip non-ATOM records
if ( file_.RecType() == PDBfile::CRYST1) {
double xyzabg[6];
file_.pdb_Box_terse( xyzabg );
frameIn.ModifyBox().AssignFromXyzAbg( xyzabg );
int is_bad_box = file_.pdb_Box_terse( xyzabg );
if (is_bad_box == 0)
frameIn.ModifyBox().AssignFromXyzAbg( xyzabg );
else {
mprintf("Warning: Disabling box information.\n");
frameIn.ModifyBox().SetNoBox();
}
}
else if ( file_.RecType() == PDBfile::ATOM ) {
// Check if we are filtering alt loc IDs
Expand Down
2 changes: 1 addition & 1 deletion src/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Whenever a number that precedes <revision> is incremented, all subsequent
* numbers should be reset to 0.
*/
#define CPPTRAJ_INTERNAL_VERSION "V6.23.2"
#define CPPTRAJ_INTERNAL_VERSION "V6.24.0"
/// PYTRAJ relies on this
#define CPPTRAJ_VERSION_STRING CPPTRAJ_INTERNAL_VERSION
#endif
Loading