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

Add NetCDF4/HDF5 support, including support for compressed NetCDF trajectories. #999

Merged
merged 227 commits into from
Nov 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
227 commits
Select commit Hold shift + click to select a range
38c61a5
DRR - Add option for creating netcdf4 (hdf5) files.
Oct 18, 2019
e67a6d7
DRR - Add option for using hdf5 under the hood
Oct 18, 2019
30e8ae7
DRR - Add a check for HDF5 support in configure
Oct 18, 2019
68311d8
DRR - Rename enum to make more general.
drroe Oct 19, 2019
0df72aa
DRR - Start new ID function
drroe Oct 19, 2019
44f7624
DRR - HDF5 depends on NetCDF
Oct 21, 2019
46da32a
DRR - Add base format detection via hex signature
Oct 21, 2019
eec0677
DRR - Fix netcdf magic number read. Add base format type to netcdf tr…
Oct 21, 2019
d406c85
DRR - Make hdf5 option without hdf5 support an error
Oct 21, 2019
08a774e
DRR - Add variable to save deflate levels for variable IDs with hdf5 …
Oct 21, 2019
9e300b7
DRR - Turn on compression for coords when specified
Oct 21, 2019
e17b64b
DRR - Add option to set compression level - needs testing.
Oct 21, 2019
d93e0cb
DRR - Add a basic netcdf4 test
Oct 21, 2019
09424a6
DRR - Try to improve the hdf5 check
drroe Oct 21, 2019
ccffb01
DRR - Revert the hdf5 detection change. Wasnt necessary. Issue was ne…
drroe Oct 22, 2019
784ac05
DRR - Change order in which sander library is linked in to avoid pull…
drroe Oct 22, 2019
9aed875
DRR - Add some protection for the HDF5 test.
Oct 22, 2019
f6202e1
DRR - Add a test with compression.
Oct 22, 2019
f336bb0
DRR - Add more vid types for compression. Make setting compression fo…
drroe Oct 23, 2019
f00afc4
DRR - Set deflate for remaining VIDs in enum type.
drroe Oct 23, 2019
4530a17
DRR - Add function for setting all compression levels
drroe Oct 23, 2019
5b5d614
DRR - Store VID descriptions as array matching VidType
Oct 24, 2019
2f99e7b
DRR - Add function for setting chunk sizes
Oct 24, 2019
459ecce
DRR - Test integer compression
Oct 24, 2019
2889f23
DRR - Turn integer shuffle on. Seems to work better.
Oct 24, 2019
c3b5c20
DRR - Add function to read integer compressed coords
Oct 24, 2019
10525c8
DRR - Define variable ID strings
Oct 24, 2019
1d50567
DRR - Start adding integer-compressed coords detection on read
Oct 24, 2019
0a2497a
DRR - Finish initial integer compressed coords read
Oct 24, 2019
4320447
DRR - Add some debug info
Oct 24, 2019
205901f
DRR - Add integer overflow protection
Oct 24, 2019
3370e49
DRR - Improve error message.
Oct 24, 2019
30d637b
DRR - Just make it the frame chunk instead of all chunks
Oct 24, 2019
3622077
DRR - Add option to change frame chunk size. Does not appear to help …
Oct 24, 2019
2507dbf
DRR - Add dimension IDs enum type. May use in the future. Make settin…
Oct 25, 2019
6e54acc
DRR - Use std::vector
Oct 25, 2019
f872b1e
DRR - Change to std::vector in more spots.
Oct 25, 2019
c3a5fc9
DRR - Set frame chunk size for more vars, but in general dont do it i…
Oct 25, 2019
771b63b
DRR - Make things private that should be private
Oct 25, 2019
9df4c1e
DRR - Reorganize functions; anything that should be HDF5 only is put …
Oct 25, 2019
6621188
DRR - better function names.
Oct 25, 2019
03c2cea
DRR - Fix compilation without HDF5
Oct 25, 2019
443696f
DRR - Add warning about low precision integer compression
Oct 25, 2019
c9f4b9c
DRR - Use default values for compress and icompress
Oct 25, 2019
f929967
DRR - Clean up output
Oct 25, 2019
f685ec6
Merge branch 'master' into netcdf4
Oct 30, 2019
73817c7
DRR - Fix test for changed keyword.
drroe Oct 30, 2019
8d34241
DRR - Add a test for lossy compression
drroe Oct 30, 2019
d55b5dc
Merge branch 'master' into netcdf4
Nov 12, 2019
035c7bc
Merge branch 'master' into netcdf4
Dec 6, 2019
d5fee52
Merge branch 'master' into netcdf4
Dec 17, 2019
732ddee
Merge branch 'master' into netcdf4
Jan 16, 2020
74e4bb9
Merge branch 'master' into netcdf4
drroe Jan 29, 2020
95911ce
Merge branch 'master' into netcdf4
Jan 31, 2020
70f5806
Merge branch 'master' into netcdf4
drroe May 22, 2020
4d06a0b
Merge branch 'master' into netcdf4
drroe Jun 14, 2020
d9a5e4d
Merge branch 'master' into netcdf4
drroe Jun 18, 2020
1d4f121
Merge branch 'master' into netcdf4
drroe Aug 24, 2020
051d48c
Merge branch 'master' into netcdf4
Oct 24, 2020
c8df00a
Merge branch 'master' into netcdf4
drroe Feb 1, 2021
9e434ee
Merge branch 'master' into netcdf4
drroe Feb 19, 2021
6fb532b
Merge branch 'master' into netcdf4
drroe May 18, 2021
7e24928
Update dependencies
drroe May 18, 2021
81c0f58
Merge branch 'master' into netcdf4
drroe May 20, 2021
1d30db7
Add nokinetic keyword to energy action
drroe May 26, 2021
6e8247c
Add missing KE-related keywords to manual
drroe May 26, 2021
86e7155
Add support for concatenating string data sets
drroe May 28, 2021
68136f7
Add position/velocity version of rattle
drroe Jun 11, 2021
5c4ff3e
Merge branch 'master' into netcdf4
drroe Jul 27, 2021
a725e81
Merge branch 'master' into netcdf4
drroe Aug 18, 2021
7af4c64
Merge branch 'master' into netcdf4
drroe Aug 26, 2021
6c27c67
Merge branch 'master' into netcdf4
drroe Mar 8, 2022
b44bf9a
Merge branch 'master' into netcdf4
drroe Mar 19, 2022
9db05c5
Merge remote-tracking branch 'origin/netcdf4' into netcdf4
drroe Mar 21, 2022
3f3463a
Merge branch 'master' into netcdf4
drroe Apr 5, 2022
c1a6846
Merge branch 'master' into netcdf4
drroe Apr 18, 2022
aa59130
Add bondparm mode for change command
drroe Apr 19, 2022
bc5dfb5
Start adding comparenergy command
drroe Apr 22, 2022
66fd222
Add in bond calc
drroe Apr 22, 2022
fd6d35e
Finish initial implementation
drroe Apr 22, 2022
6b6af0f
Start full precision COORDS set
drroe Apr 25, 2022
0dbf4c2
Add more functions
drroe Apr 25, 2022
405b748
Finish and enable the set
drroe Apr 25, 2022
ae31e6f
Enable the double precision array set
drroe Apr 25, 2022
28e2908
Add test for new double precision coords array
drroe Apr 25, 2022
0e6e727
Add masks and an output file.
drroe Apr 25, 2022
87a7565
Change to avgDelta2
drroe Apr 25, 2022
1a62680
Add E0, E1, and average delta
drroe Apr 25, 2022
f297f59
Put res/atom name info in the output file
drroe Apr 25, 2022
4f5b344
Save bond delta E to data set. Report bond lengths and length delta.
drroe Apr 25, 2022
280138e
Add R delta set and stats
drroe Apr 26, 2022
7bae279
Add a header
drroe Apr 26, 2022
26e9543
Change to Harmonic, can be used for angles too
drroe Apr 27, 2022
7dd9a93
Start a class template to generalize the energy comparison calc
drroe Apr 27, 2022
6cf70ad
Curate the bond arrays beforehand
drroe Apr 27, 2022
334dbd6
Clean up and remove old code
drroe Apr 27, 2022
27a9755
Add angle comparison
drroe Apr 27, 2022
423ee22
Add dihedral comparison
drroe Apr 28, 2022
231b31f
Use round to try and reduce truncation errors.
drroe Apr 29, 2022
a1f027d
Merge branch 'master' into netcdf4
drroe May 6, 2022
763bf70
Merge branch 'master' into netcdf4
drroe May 16, 2022
fef786b
More verbose check for BufferedFrame read
drroe May 19, 2022
cb3f247
Better error checking for gzip read/write, and move gz calls to outside
drroe May 20, 2022
ca011e7
N bytes read < expected is only an error if negative.
drroe May 20, 2022
403017d
Better trap gzseek errors
drroe May 20, 2022
3fea063
Better error trapping for gzrewind and gzgets
drroe May 20, 2022
edee726
Null from gzgets can be EOF or an error, distinguish between the two
drroe May 20, 2022
4a768b7
Recognize if netcdf is actually h5
drroe May 24, 2022
2869f25
Start H5 trajectory class
drroe May 24, 2022
ee22e4b
Recognize frame, spatial, and atom dimensions
drroe May 24, 2022
f6a5faf
Split off coordinates VID setup
drroe May 25, 2022
873bb48
Add box setup and coordinate conversion
drroe May 25, 2022
aa67803
Implement trajectory read
drroe May 25, 2022
942c01a
Comment out some debug info
drroe May 25, 2022
c04af19
Merge branch 'master' into netcdf4
drroe Jun 24, 2022
44ce85e
Start checking for h5md
drroe Jun 27, 2022
a740181
Add routine for getting group names
drroe Jun 27, 2022
8006f12
Add version that saves the ncids
drroe Jun 27, 2022
60c209c
Start H5MD reader
drroe Jun 27, 2022
f4fa708
Group detection now in NC_Routines
drroe Jun 27, 2022
6049219
Initial enabling of h5md
drroe Jun 27, 2022
a78d8c7
Get particle and trajectory groups
drroe Jun 27, 2022
da9d626
Get box and position Ids
drroe Jun 27, 2022
2775f2e
Use position group id instead of ncid
drroe Jun 27, 2022
107fa24
Add some code for unit conversion
drroe Jun 27, 2022
844e821
Handle string attributes as well as char attributes
drroe Jun 27, 2022
7dae3f4
Use Units
drroe Jun 27, 2022
28f6a02
Do unit cell setup
drroe Jun 27, 2022
dead288
Store position and edges gid in class
drroe Jun 27, 2022
e254eca
Finish initial read
drroe Jun 27, 2022
b2b972f
Use Units
drroe Jun 27, 2022
3ecd0ce
Hide some debug info
drroe Jun 27, 2022
9251635
Improve unit recognition
drroe Jun 28, 2022
d9223e5
Start amber ascii energy file reader
drroe Jul 5, 2022
aa01d99
Enable amber ene read. Read headers.
drroe Jul 5, 2022
a0cd77d
Store line details in class
drroe Jul 5, 2022
831f0b9
Merge branch 'master' into netcdf4
drroe Jul 5, 2022
8ae0883
Ensure we stop reading headers when necessary
drroe Jul 5, 2022
db51f67
Finish initial amber ene read
drroe Jul 5, 2022
fc74137
Add amber ene format to datafile table
drroe Jul 5, 2022
c5f7ed6
Fix include
drroe Jul 5, 2022
54caa69
Add generalize compression write routine
drroe Jul 5, 2022
7bdd3ed
Use new compression routine
drroe Jul 5, 2022
df0cea5
Add generalized int compress read routine
drroe Jul 5, 2022
708e69a
Use new routine
drroe Jul 5, 2022
f4f7181
Make variables private
drroe Jul 5, 2022
3ace3aa
Start adding support for compressed velocities
drroe Jul 5, 2022
ab5df6c
Create routine to separately define integer compressed var
drroe Jul 5, 2022
43bdc67
Use new routine
drroe Jul 5, 2022
932d5de
Add description to error messages.
drroe Jul 5, 2022
8eefc0d
Rework code so that integer-compressed variables are defined in
drroe Jul 6, 2022
4c8ffc8
Hide some debug info. More feedback when writing compressed traj.
drroe Jul 6, 2022
2e1a7d3
Make it so that integer compressed coords are written last; is in line
drroe Jul 6, 2022
040910d
Add compressed force/vel read setup
drroe Jul 7, 2022
178d373
Set velocity and force read/write. Start setting up velocity write
drroe Jul 7, 2022
b9266e5
Set up write for compressed forces
drroe Jul 7, 2022
eca37f4
Enable using compressed force/vel as compressed coord
drroe Jul 7, 2022
a3e3815
Fix names
drroe Jul 7, 2022
15a154d
Test run with velocities and forces
drroe Jul 7, 2022
885e684
Add test reading frc/vel from netcdf generated by simulation
drroe Jul 7, 2022
eaf6f39
Test regular compression of vel/frc info
drroe Jul 7, 2022
8bea963
Ensure we do not write uncompressed vel/frc if writing compressed
drroe Jul 7, 2022
ac815f9
Add test for lossy compression of force/velocity info
drroe Jul 7, 2022
5400b1a
Merge branch 'master' into netcdf4
drroe Jul 11, 2022
31dfb2b
Merge branch 'master' into netcdf4
drroe Jul 13, 2022
259b628
Add option to turn integer shuffling on or off
drroe Jul 13, 2022
1d16999
Merge branch 'master' into netcdf4
drroe Jul 20, 2022
e29b26c
Merge branch 'master' into netcdf4
drroe Jul 20, 2022
2e91a1d
Merge branch 'master' into netcdf4
drroe Jul 29, 2022
d1d65c9
Merge branch 'master' into netcdf4
drroe Sep 1, 2022
61d7b39
Merge branch 'master' into netcdf4
drroe Nov 9, 2022
3845c54
Try to add hdf5 build
Nov 10, 2022
df821fd
Add specific check for just HDF5 functionality, allow it to be built
Nov 10, 2022
3b0b65e
Add missing test save files
drroe Nov 10, 2022
06a4d30
Merge branch 'netcdf4' into netcdf4.gethdf5
Nov 11, 2022
7a8db8e
Netcdf4/hdf5 has a race condition, so force make -j1
Nov 11, 2022
7d40c7f
Add some debug lines
Nov 11, 2022
5c09765
First check if netcdf library has hdf5 support; only try to test/build
Nov 11, 2022
ca82f66
Add ifdefs for non-HDF5 compile
Nov 11, 2022
f522b1d
Fix var name
Nov 11, 2022
9ef7e6d
Have compress and icompress be outside the ifdef but set to zero
Nov 11, 2022
adca630
Protect more netcdf4/hdf5 only routines
Nov 11, 2022
0ad0c67
Dont test hdf5 without netcdf
Nov 11, 2022
a167731
NcFmtTypeStr_ needs to be present outside BINTRAJ
Nov 11, 2022
dc4f8be
Protect when no netcdf4/hdf5
Nov 11, 2022
41f7202
If netcdf was specified, make hdf5 failure an error unless -nohdf5
Nov 11, 2022
73a9a06
If forcing a netcdf build and hdf5 is enabled, tell netcdf how to link
drroe Nov 11, 2022
cd1b064
Fix var name in MPI compile. Remove debug message
drroe Nov 14, 2022
4e2691e
If initial pnetcdf check fails, see if pnetcdf was built with netcdf4
Nov 15, 2022
ea739f7
Trap netcdf4 write with > 1 process, not yet supported. Will need to use
Nov 15, 2022
416b139
Protect tests in parallel
Nov 15, 2022
317471e
Note that compareenergy is currently hidden
Nov 15, 2022
123fd66
Add bond energy template
Nov 15, 2022
12f0c6d
Use Ene_Bond
Nov 15, 2022
f0004da
Start adding test for compareenergy even though command is hidden
Nov 15, 2022
0640919
Test angles and dihedrals
Nov 15, 2022
69df6b8
Move to energy dir
Nov 15, 2022
7ee3a1e
Point to the moved file
Nov 15, 2022
67d799b
Use harmonic kernel
Nov 15, 2022
abd1364
Move to subdir
Nov 15, 2022
cc39738
Use moved kernel
Nov 15, 2022
2c4b02a
Enable the compareenergy test
Nov 15, 2022
0345619
Add amber ene read test
drroe Nov 16, 2022
7743e88
Add h5md keyword and extension
drroe Nov 16, 2022
eb6a077
Add new hdf5 and netcdf options
drroe Nov 16, 2022
85aa2a6
Add amber energy file to table
drroe Nov 16, 2022
871a795
Add name keyword to timecorr
drroe Nov 16, 2022
eb252d3
Update loadcrd; fix up loadtraj
drroe Nov 16, 2022
ec663bd
Fix typo in help
drroe Nov 16, 2022
5083dd0
Add change bondparm entry
drroe Nov 16, 2022
5b1b8f8
Add note about dataset cat only working for scalar 1d and string sets.
drroe Nov 16, 2022
d7b3115
Fix potential memory issue and error in ArrayToRangeExpression
drroe Nov 16, 2022
f6ee6b9
Shorten output so it fits on the page
drroe Nov 16, 2022
d69d7e9
Minor version bump for addition of NetCDF4/HDF5 support.
drroe Nov 16, 2022
e87485d
Add missing test file
drroe Nov 16, 2022
aca1df4
Pull in netcdf explicitly for cmake. Have configure builds use
drroe Nov 16, 2022
03ef0a2
Update estimate; quantization is using rounding
drroe Nov 16, 2022
63253ea
Fix formatting error
drroe Nov 16, 2022
9578cc6
Protect against z_off_t being unsigned - flagged by LGTM
drroe Nov 16, 2022
e063981
Fix arg format
drroe Nov 16, 2022
9e610ad
Add 'source' command
drroe Nov 16, 2022
95b7855
Add -nohdf5 flag
drroe Nov 16, 2022
662b48f
Try to fix appveyor build fail with cmake/VS
drroe Nov 16, 2022
5386f74
Try to use previous VS 2019 image to see if it fixes any of the issues.
drroe Nov 17, 2022
1297a69
Add missing include algorithm for std::max
drroe Nov 17, 2022
3018f54
Change back to z_off_t. Problem was the extra <0. Check should work now.
drroe Nov 17, 2022
569c940
Fix mkl fftw now that default for fftw is enabled
drroe Nov 17, 2022
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
23 changes: 12 additions & 11 deletions .github/workflows/merge-gate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,6 @@ jobs:
mkdir -p include && mv AmberTools/src/sander/sander.h include
mv lib include $HOME

curl -OL ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4.6.1.tar.gz
tar -zxf netcdf-4.6.1.tar.gz
cd netcdf-4.6.1
./configure --disable-netcdf-4 --disable-dap --disable-doxygen --prefix=$HOME
make -j2
make install
cd ..
export PATH=$HOME/bin:$PATH
export LD_LIBRARY_PATH=$HOME/lib:${LD_LIBRARY_PATH}

if [ $USE_OPENMP = "yes" ]; then
export OPT="openmp"
export OMP_NUM_THREADS=4
Expand Down Expand Up @@ -105,6 +95,16 @@ jobs:
fi

if [ "$USE_CMAKE" = "1" ]; then
curl -OL ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4.6.1.tar.gz
tar -zxf netcdf-4.6.1.tar.gz
cd netcdf-4.6.1
./configure --disable-netcdf-4 --disable-dap --disable-doxygen --prefix=$HOME
make -j2
make install
cd ..
export PATH=$HOME/bin:$PATH
export LD_LIBRARY_PATH=$HOME/lib:${LD_LIBRARY_PATH}

mkdir build install
installdir=$(pwd)
cd build
Expand All @@ -117,7 +117,8 @@ jobs:
export PATH=$installdir/bin:$PATH
else
export LD_LIBRARY_PATH=$HOME/lib:${LD_LIBRARY_PATH}
./configure --with-netcdf=$HOME ${BUILD_FLAGS} ${COMPILER}
./configure --buildlibs ${BUILD_FLAGS} ${COMPILER}
source cpptraj.sh
make -j2 install
fi
cd test && make $TEST_TYPE
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
platform:
- x64

image: Visual Studio 2019
image: Previous Visual Studio 2019

clone_folder: c:\projects\cpptraj

Expand Down
158 changes: 145 additions & 13 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ NETCDF_SRCTAR='netcdf-4.6.1.tar.gz'
NETCDF_SRCDIR='netcdf-4.6.1'
NETCDF_URL="ftp://ftp.unidata.ucar.edu/pub/netcdf/$NETCDF_SRCTAR"
NETCDF_OPTS=" --disable-netcdf-4 --disable-dap $windows_hostflag --disable-shared --disable-doxygen"
NETCDF4_OPTS=" --disable-dap $windows_hostflag --disable-shared --disable-doxygen"

HDF5_SRCTAR='hdf5-1_10_9.tar.gz'
HDF5_SRCDIR='hdf5-hdf5-1_10_9'
HDF5_URL="https://github.com/HDFGroup/hdf5/archive/refs/tags/$HDF5_SRCTAR"
HDF5_OPTS=''

BZIP2_SRCTAR='bzip2-latest.tar.gz'
BZIP2_SRCDIR=''
Expand Down Expand Up @@ -222,13 +228,14 @@ LBLAS=7
LFFTW3=8
LREADLINE=9
LXDRFILE=10
LSANDER=11
LTIMER=12
LCUDA=13
LHIP=14
LOPENMM=15
LTIMER=11
LCUDA=12
LHIP=13
LOPENMM=14
LHDF5=15
LSANDER=16 # Make sure this comes last to avoid pulling in unnecessary symbols
# Total number of external libraries
NLIB=16
NLIB=17

# LIB_STAT = Library status:
# off : Do not use library.
Expand Down Expand Up @@ -336,7 +343,7 @@ LIB_FLAG[$LSANDER]='-lsander'
LIB_STTC[$LSANDER]=''
LIB_D_ON[$LSANDER]='-DUSE_SANDERLIB'
LIB_DOFF[$LSANDER]=''
LIB_TYPE[$LSANDER]='cpp'
LIB_TYPE[$LSANDER]='ld'

LIB_STAT[$LTIMER]='off'
LIB_CKEY[$LTIMER]='timer'
Expand Down Expand Up @@ -372,6 +379,16 @@ LIB_D_ON[$LTNGFILE]='-DHAS_TNGFILE'
LIB_DOFF[$LTNGFILE]=''
LIB_TYPE[$LTNGFILE]='cpp'

LIB_STAT[$LHDF5]='enabled'
LIB_CKEY[$LHDF5]='hdf5'
LIB_HOME[$LHDF5]=''
LIB_FLAG[$LHDF5]=''
LIB_STTC[$LHDF5]='libhdf5.a'
LIB_D_ON[$LHDF5]='-DHAS_HDF5'
LIB_DOFF[$LHDF5]=''
LIB_LINK[$LHDF5]='dynamic'
LIB_TYPE[$LHDF5]='ld'

LIB_STAT[$LOPENMM]='off'
LIB_CKEY[$LOPENMM]='openmm'
LIB_HOME[$LOPENMM]=''
Expand Down Expand Up @@ -531,6 +548,8 @@ TestProgram() {
else
COMPILE_ERROR_LINE=$COMPILELINE
COMPILE_ERROR_MESSAGE=`cat $COMPERR`
#echo "DEBUG: Error: $COMPILE_ERROR_LINE"
#echo "DEBUG: Error: $COMPILE_ERROR_MESSAGE"
rm $COMPERR $COMPOUT
return 1
fi
Expand Down Expand Up @@ -641,6 +660,82 @@ EOF
fi
}

TestHdf5() {
# First, check if NetCDF has HDF5 support baked in.
cat > testp.cpp <<EOF
#include <cstdio>
#include "netcdf.h"
void unused() {
int ncid, varid;
int dims[1];
// Create a netcdf4 file
nc_create("foo.nc", NC_NETCDF4, &ncid);
// Create a dimension
dims[1] = 10;
nc_def_var(ncid, "MyVar", NC_DOUBLE, 1, dims, &varid);
// Set deflate
int err = nc_def_var_deflate(ncid, varid, NC_SHUFFLE, 1, 1);
}
int main() { printf("Testing\n"); printf("%s\n",nc_strerror(0)); return 0; }
EOF
TestProgram silent " Checking NetCDF4/HDF5" "$CXX" "$CXXFLAGS ${LIB_INCL[$LNETCDF]}" testp.cpp "${LIB_FLAG[$LNETCDF]}"
if [ $? -eq 0 ] ; then
# HDF5 support is present.
# If we are going to build our own netcdf, it needs to know how to link
# HDF5.
if [ "${LIB_MAKE[$LNETCDF]}" = 'yes' ] ; then
LIB_FLAG[$LHDF5]="-lhdf5_hl -lhdf5 -ldl ${LIB_FLAG[$LZIP]}"
fi
return 0
fi
# If netcdf was specified, this means netcdf was built without hdf5 support
if [ "${LIB_STAT[$LNETCDF]}" = 'specified' ] ; then
ErrMsg "NetCDF in '${LIB_HOME[$LNETCDF]}' does not have HDF5 support."
ErrMsg "To use this NetCDF, disable HDF5 support with '-nohdf5'."
exit 1
fi
# Check for separate HDF5
cat > testp.cpp <<EOF
#include <cstdio>
#include "hdf5.h"
void unused() {
hid_t file;
file = H5Fcreate("tmp", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
herr_t status = H5Fclose(file);
}
int main() {
printf("Testing\n");
return 0;
}
EOF
TestProgram silent " Checking HDF5" "$CXX" "$CXXFLAGS ${LIB_INCL[$LHDF5]}" testp.cpp "${LIB_FLAG[$LHDF5]}"
if [ $? -ne 0 ] ; then
if [ "${LIB_STAT[$LHDF5]}" = 'enabled' ] ; then
# See if there is already a version of HDF5 in CPPTRAJHOME
LIB_STAT[$LHDF5]='specified'
LIB_HOME[$LHDF5]=$CPPTRAJHOME
LIB_FLAG[$LHDF5]="$CPPTRAJHOME/lib/libhdf5_hl.a $CPPTRAJHOME/lib/${LIB_STTC[$LHDF5]} -ldl ${LIB_FLAG[$LZIP]}"
LIB_INCL[$LHDF5]="-I$CPPTRAJHOME/include"
TestProgram $BUILDTESTOPT " Checking for bundled HDF5" "$CXX" "$CXXFLAGS ${LIB_INCL[$LHDF5]}" testp.cpp "${LIB_FLAG[$LHDF5]}"
if [ $? -ne 0 ] ; then
CheckRebuild "HDF5" "${LIB_FLAG[$LHDF5]}"
# See if user would like to get HDF5
PREFIX=$CPPTRAJHOME CC=$CC CFLAGS=$CFLAGS LIBNAME='hdf5' \
SRCDIR=$HDF5_SRCDIR SRCTAR=$HDF5_SRCTAR URL=$HDF5_URL ./get_library.sh $REBUILDOPT $HDF5_OPTS
if [ $? -ne 0 ] ; then
ErrMsg "Building HDF5 failed."
exit 1
fi
# Test the built HDF5
TestProgram " Checking built HDF5" "$CXX" "$CXXFLAGS ${LIB_INCL[$LHDF5]}" testp.cpp "${LIB_FLAG[$LHDF5]}"
fi
else
# HDF5 specified but failed.
TestProgErr "HDF5"
fi
fi
}

TestNetcdf() {
cat > testp.cpp <<EOF
#include <cstdio>
Expand All @@ -663,14 +758,35 @@ EOF
LIB_HOME[$LNETCDF]=$CPPTRAJHOME
LIB_FLAG[$LNETCDF]=$CPPTRAJHOME/lib/${LIB_STTC[$LNETCDF]}
LIB_INCL[$LNETCDF]="-I$CPPTRAJHOME/include"
if [ "${LIB_STAT[$LHDF5]}" != 'off' ] ; then
# Netcdf needs to know where hdf5 is
LIB_FLAG[$LNETCDF]="${LIB_FLAG[$LNETCDF]} ${LIB_FLAG[$LHDF5]}"
LIB_INCL[$LNETCDF]="${LIB_INCL[$LNETCDF]} ${LIB_INCL[$LHDF5]}"
fi
TestProgram $BUILDTESTOPT " Checking for bundled NetCDF" "$CXX" "$CXXFLAGS ${LIB_INCL[$LNETCDF]}" testp.cpp "${LIB_FLAG[$LNETCDF]}"
if [ $? -ne 0 ] ; then
# Check if lib present but needs to be rebuilt
CheckRebuild "NetCDF" "${LIB_FLAG[$LNETCDF]}"
# See if user would like to get netcdf
PREFIX=$CPPTRAJHOME CC=$CC CFLAGS=$CFLAGS LIBNAME='netcdf' \
SRCDIR=$NETCDF_SRCDIR SRCTAR=$NETCDF_SRCTAR URL=$NETCDF_URL ./get_library.sh $rebuild_netcdf $NETCDF_OPTS
if [ $? -ne 0 ] ; then
if [ "${LIB_STAT[$LHDF5]}" != 'off' ] ; then
# Get/compile netcdf4 with HDF5
# Some of the HDF5-related portions of NetCDF4 have race conditions,
# so override MAKE_COMMAND
if [ -z "$MAKE_COMMAND" ] ; then
echo "Setting MAKE_COMMAND to 'make -j1' to avoid NetCDF4/HDF5 race conditions."
else
echo "Overriding MAKE_COMMAND with 'make -j1' to avoid NetCDF4/HDF5 race conditions."
fi
PREFIX=$CPPTRAJHOME CC=$CC CFLAGS=$CFLAGS LIBNAME='netcdf' MAKE_COMMAND='make -j1' \
CPPFLAGS=${LIB_INCL[$LHDF5]} LDFLAGS="-L$CPPTRAJHOME/lib" \
SRCDIR=$NETCDF_SRCDIR SRCTAR=$NETCDF_SRCTAR URL=$NETCDF_URL ./get_library.sh $rebuild_netcdf $NETCDF4_OPTS
netcdferr=$?
else
# Get/compile netcdf3
PREFIX=$CPPTRAJHOME CC=$CC CFLAGS=$CFLAGS LIBNAME='netcdf' \
SRCDIR=$NETCDF_SRCDIR SRCTAR=$NETCDF_SRCTAR URL=$NETCDF_URL ./get_library.sh $rebuild_netcdf $NETCDF_OPTS
netcdferr=$?
fi
if [ $netcdferr -ne 0 ] ; then
ErrMsg "Building NetCDF failed."
exit 1
fi
Expand All @@ -692,7 +808,16 @@ void unused() {int ncid; ncmpi_open(MPI_COMM_WORLD, "foo.nc", NC_NOWRITE, MPI_IN
int main() { printf("Testing\n"); printf("%s\n",ncmpi_strerror(0)); return 0; }
EOF
TestProgram silent " Checking Parallel NetCDF" "$CXX" "$CXXFLAGS ${LIB_INCL[$LPARANC]}" testp.cpp "${LIB_FLAG[$LPARANC]}"
if [ $? -ne 0 ] ; then
pnetcdfstat=$?
# Check if pnetcdf just needs netcdf support
if [ $pnetcdfstat -ne 0 -a "${LIB_STAT[$LPARANC]}" = 'specified' ] ; then
TestProgram silent " Checking Parallel NetCDF (link to NetCDF)" "$CXX" "$CXXFLAGS ${LIB_INCL[$LPARANC]} ${LIB_INCL[$LNETCDF]}" testp.cpp "${LIB_FLAG[$LPARANC]} ${LIB_FLAG[$LNETCDF]}"
pnetcdfstat=$?
# If above check worked, pnetcdf should be linked OK with netcdf flags
return 0
#echo "DEBUG: Returned $?"
fi
if [ $pnetcdfstat -ne 0 ] ; then
if [ "${LIB_STAT[$LPARANC]}" = 'optional' ] ; then
WrnMsg "Parallel NetCDF test failed. CPPTRAJ will be built without parallel NetCDF."
LIB_STAT[$LPARANC]='off'
Expand Down Expand Up @@ -1103,6 +1228,7 @@ TestLibraries() {
fi
if [ "${LIB_TEST[$LBZIP]}" = 'yes' ] ; then TestBzlib ; fi
if [ "${LIB_TEST[$LZIP]}" = 'yes' ] ; then TestZlib ; fi
if [ "${LIB_TEST[$LHDF5]}" = 'yes' ] ; then TestHdf5 ; fi
if [ "${LIB_TEST[$LNETCDF]}" = 'yes' ] ; then TestNetcdf ; fi
if [ "${LIB_TEST[$LPARANC]}" = 'yes' ] ; then TestPnetcdf ; fi
if [ "${LIB_TEST[$LBLAS]}" = 'yes' ] ; then TestMathlib ; fi
Expand Down Expand Up @@ -1425,6 +1551,12 @@ SetupLibraries() {
echo "Warning: TNG depends on libz; disabling TNG."
LIB_STAT[$LTNGFILE]='off'
fi
if [ "${LIB_STAT[$LNETCDF]}" = 'off' -a "${LIB_STAT[$LHDF5]}" != 'off' ] ; then
# HDF5 needs netcdf
echo "Warning: HDF5 depends on NetCDF; disabling HDF5."
LIB_STAT[$LHDF5]='off'
LIB_TEST[$LHDF5]='no'
fi
}

#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -1893,7 +2025,7 @@ SetupMKL() {
LIB_FLAG[$LLAPACK]=''
# If no FFTW, try using MKL
if [ "$MKL_FFTW" != 'no' ] ; then
if [ "${LIB_STAT[$LFFTW3]}" = 'off' -o "${LIB_STAT[$LFFTW3]}" = 'optional' ] ; then
if [ "${LIB_STAT[$LFFTW3]}" = 'off' -o "${LIB_STAT[$LFFTW3]}" = 'optional' -o "${LIB_STAT[$LFFTW3]}" = 'enabled' ] ; then
MKL_FFTW='yes'
LIB_STAT[$LFFTW3]='enabled'
LIB_FLAG[$LFFTW3]=''
Expand Down
2 changes: 1 addition & 1 deletion devtools/ci/appveyor/build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ if %BUILD_TYPE% equ cmake-mingw (
)

if %BUILD_TYPE% equ configure-mingw (
sh -lc "./configure --with-netcdf=/mingw64/ --with-blas=/mingw64/ -openblas --with-bzlib=/mingw64/ --with-zlib=/mingw64 --with-arpack=/mingw64 --with-readline=/mingw64/ -nofftw3 -shared -windows gnu" || exit /b
sh -lc "./configure -nohdf5 --with-netcdf=/mingw64/ --with-blas=/mingw64/ -openblas --with-bzlib=/mingw64/ --with-zlib=/mingw64 --with-arpack=/mingw64 --with-readline=/mingw64/ -nofftw3 -shared -windows gnu" || exit /b
make libcpptraj -j2 || exit /b
make install -j2 || exit /b
)
Expand Down
7 changes: 7 additions & 0 deletions doc/cpptraj.bib
Original file line number Diff line number Diff line change
Expand Up @@ -437,3 +437,10 @@ @article{Roe2022
issue = {13},
year = {2022}
}

@article{Roe2022a,
author = {Roe, Daniel R. and Brooks, Bernard R.},
journal = {Protein Science},
title = {{ Quantifying the Effects of Lossy Compression on Energies Calculated from Molecular Dynamics Trajectories}},
year = {2022}
}
Loading