Skip to content

Commit

Permalink
Release 2.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
JureCerar committed Aug 2, 2021
1 parent 5f745ff commit 42cd696
Show file tree
Hide file tree
Showing 47 changed files with 13,033 additions and 12,762 deletions.
2 changes: 1 addition & 1 deletion .VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.6.0
2.6.1
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools"
}
216 changes: 108 additions & 108 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,108 +1,108 @@
# xslib - Extra-Small Library

[![Version](https://img.shields.io/badge/Version-v2.6.0-blue.svg)](https://github.com/JureCerar/xslib/releases)
![Language](https://img.shields.io/badge/Language-Fortran,_C-brightgreen.svg)
[![License](https://img.shields.io/badge/License-GNU_GPL_v3.0-red.svg)](https://www.gnu.org/licenses/gpl-3.0.html)

<!--
NOTE: Old dynamic badge for package version.
[![GitHub version](https://img.shields.io/github/release/JureCerar/xslib.svg?label=Version&color=blue)](https://github.com/JureCerar/xslib/releases)
Generic badge:
[![Generic badge](https://img.shields.io/badge/<SUBJECT>-<STATUS>-<COLOR>.svg)](https://shields.io/)
-->

The Extra-Small Library (xslib) is a modern Fortran library consisting of useful utilities and functions that "computer chemist" might need during his/her work. It uses an object-oriented philosophy for reading and storing data for analysis. The library is written with primary purpose of learning modern Fortran language, good coding practices, and in hopes that it helps someone else in their pursuit of knowledge.

The library features functions to handle different molecular file types:
- [.xyz](https://en.wikipedia.org/wiki/XYZ_file_format) - Simple *"name,x,y,z"* file that gets the job done in most cases,
- [.gro](http://manual.gromacs.org/archive/5.0.3/online/gro.html) - GROMACS coordinate file,
- [.pdb](https://www.rcsb.org/pdb/static.do?p=file_formats/pdb/index.html) - Protein Data Bank which is most commonly used and widely spread molecular coordinate file,
- [.xtc](http://manual.gromacs.org/archive/5.0.3/online/xtc.html) - GROMACS compressed binary trajectory files,
- [.trr](hhttp://manual.gromacs.org/archive/5.0.3/online/trr.html) - GROMACS binary trajectory files containing coordinates/velocities/forces,
- [.dcd](https://www.ks.uiuc.edu/Research/namd/2.9/ug/node11.html) - Single precision binary trajectory used by NAMD, CHARMM and LAMMPS,
- [.cub](https://h5cube-spec.readthedocs.io/en/latest/cubeformat.html) - Gaussian CUBE file format,

supporting file types:
- [.ndx](http://manual.gromacs.org/archive/5.0.3/online/ndx.html) - GROMACS index file containing user defined sets of atoms,
- [.tpl]() - Our own proprietary file type with condensed configuration information,

and data file types
- [.pdh](http://goldenberg.biology.utah.edu/downloads/usTooDocs_Sept2012.pdf) - Standard format for storing Small-Angle X-Ray Scattering (SAXS) data.
- [.csv](https://en.wikipedia.org/wiki/Comma-separated_values) - Comma-separated value files.

## Build & Install
Clone or download repository from GitHub:
```bash
git clone https://github.com/JureCerar/xslib
```
Move into directory and type the following:
```bash
mkdir build
cd build
cmake ..
make
make check
```
To install library type the following as *root* (or *sudo*):
```bash
make install
```
You should consider using the following [CMake options](https://cmake.org/cmake/help/v3.6/manual/cmake.1.html) with the appropriate value instead of `xxx`:
- `-DCMAKE_Fortran_COMPILER=xxx` equal to the name of the Fortran Compiler you wish to use (or the ENV variable `FC`)
- `-DCMAKE_C_COMPILER=xxx` equal to the name of the C Compiler you wish to use (or the ENV variable `CC`)
- `-DCMAKE_INSTALL_PREFIX=xxx` to install xslib to a non-standard location (default `/usr/local/lib/`)
- `-DCMAKE_BUILD_TYPE=xxx` equal to `RELEASE` for normal build or `DEBUG` for debugging purposes.

## Usage
On how to interface with the xslib library, please read [API documentation](doc/API.md) below.
To use the library put `use xslib` in the module section of your program:
```fortran
program main
use xslib
implicit none
! ...
end program main
```
When compiling your program add `-lxslib` flag. You may also need to use `-I` flag to point to where the modules files are (default *-I/usr/local/include*) even with all of the right environment variables set. When linking use `-L` to point to library file (default *-L/usr/local/lib*).

To make things easier **pkg-config** file is also included to help you with your program compilation. You may need to add the config file to `PKG_CONFIG_PATH` environment variable (default */usr/local/lib/pkgconfig*).
```bash
pkg-config xslib --libs --cflags
```

Alternatively, the library can be added via **CMake**:
```cmake
# Find xslib package
find_package ( xslib 2.0.0 REQUIRED )
include_directories ( ${xslib_INCLUDE_DIRS} )
...
# link (shared) xslib library
target_link_libraries ( ${CMAKE_PROJECT_NAME} ${xslib_LIBRARIES} )
# or link STATIC xslib library
target_link_libraries ( ${CMAKE_PROJECT_NAME} ${xslib_STATIC_LIBRARIES} )
```
**NOTE:** In case of non-standard installation path use the following CMake option (with the appropriate value instead of `xxx`):
- `-Dxslib_DIR=xxx` equal to path to `xslib-config.cmake` (default is */usr/local/lib/cmake/xslib-X.X.X/* ).

## [API documentation](doc/README.md)

## [Changelog](doc/CHANGELOG.md)

## Acknowledgments
This library includes modified versions of [libxdrfile](https://github.com/wesbarnett/libxdrfile) and its Fortran wrapper [libgmxfort](https://github.com/wesbarnett/libgmxfort) for reading GROMACS .ndx, .trr, and .xtc files created by [James W. Barnett](https://github.com/wesbarnett).

<!-- Basically, he is my hero. -->

## License
This program is licensed under the **GNU General Public License v3.0**

Copyright (C) 2019-2020 [Jure Cerar](https://github.com/JureCerar)

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
# xslib - Extra-Small Library

[![Version](https://img.shields.io/badge/Version-v2.6.0-blue.svg)](https://github.com/JureCerar/xslib/releases)
![Language](https://img.shields.io/badge/Language-Fortran,_C-brightgreen.svg)
[![License](https://img.shields.io/badge/License-GNU_GPL_v3.0-red.svg)](https://www.gnu.org/licenses/gpl-3.0.html)

<!--
NOTE: Old dynamic badge for package version.
[![GitHub version](https://img.shields.io/github/release/JureCerar/xslib.svg?label=Version&color=blue)](https://github.com/JureCerar/xslib/releases)
Generic badge:
[![Generic badge](https://img.shields.io/badge/<SUBJECT>-<STATUS>-<COLOR>.svg)](https://shields.io/)
-->

The Extra-Small Library (xslib) is a modern Fortran library consisting of useful utilities and functions that "computer chemist" might need during his/her work. It uses an object-oriented philosophy for reading and storing data for analysis. The library is written with primary purpose of learning modern Fortran language, good coding practices, and in hopes that it helps someone else in their pursuit of knowledge.

The library features functions to handle different molecular file types:
- [.xyz](https://en.wikipedia.org/wiki/XYZ_file_format) - Simple *"name,x,y,z"* file that gets the job done in most cases,
- [.gro](http://manual.gromacs.org/archive/5.0.3/online/gro.html) - GROMACS coordinate file,
- [.pdb](https://www.rcsb.org/pdb/static.do?p=file_formats/pdb/index.html) - Protein Data Bank which is most commonly used and widely spread molecular coordinate file,
- [.xtc](http://manual.gromacs.org/archive/5.0.3/online/xtc.html) - GROMACS compressed binary trajectory files,
- [.trr](hhttp://manual.gromacs.org/archive/5.0.3/online/trr.html) - GROMACS binary trajectory files containing coordinates/velocities/forces,
- [.dcd](https://www.ks.uiuc.edu/Research/namd/2.9/ug/node11.html) - Single precision binary trajectory used by NAMD, CHARMM and LAMMPS,
- [.cub](https://h5cube-spec.readthedocs.io/en/latest/cubeformat.html) - Gaussian CUBE file format,

supporting file types:
- [.ndx](http://manual.gromacs.org/archive/5.0.3/online/ndx.html) - GROMACS index file containing user defined sets of atoms,
- [.tpl]() - Our own proprietary file type with condensed configuration information,

and data file types
- [.pdh](http://goldenberg.biology.utah.edu/downloads/usTooDocs_Sept2012.pdf) - Standard format for storing Small-Angle X-Ray Scattering (SAXS) data.
- [.csv](https://en.wikipedia.org/wiki/Comma-separated_values) - Comma-separated value files.

## Build & Install
Clone or download repository from GitHub:
```bash
git clone https://github.com/JureCerar/xslib
```
Move into directory and type the following:
```bash
mkdir build
cd build
cmake ..
make
make check
```
To install library type the following as *root* (or *sudo*):
```bash
make install
```
You should consider using the following [CMake options](https://cmake.org/cmake/help/v3.6/manual/cmake.1.html) with the appropriate value instead of `xxx`:
- `-DCMAKE_Fortran_COMPILER=xxx` equal to the name of the Fortran Compiler you wish to use (or the ENV variable `FC`)
- `-DCMAKE_C_COMPILER=xxx` equal to the name of the C Compiler you wish to use (or the ENV variable `CC`)
- `-DCMAKE_INSTALL_PREFIX=xxx` to install xslib to a non-standard location (default `/usr/local/lib/`)
- `-DCMAKE_BUILD_TYPE=xxx` equal to `RELEASE` for normal build or `DEBUG` for debugging purposes.

## Usage
On how to interface with the xslib library, please read [API documentation](doc/API.md) below.
To use the library put `use xslib` in the module section of your program:
```fortran
program main
use xslib
implicit none
! ...
end program main
```
When compiling your program add `-lxslib` flag. You may also need to use `-I` flag to point to where the modules files are (default *-I/usr/local/include*) even with all of the right environment variables set. When linking use `-L` to point to library file (default *-L/usr/local/lib*).

To make things easier **pkg-config** file is also included to help you with your program compilation. You may need to add the config file to `PKG_CONFIG_PATH` environment variable (default */usr/local/lib/pkgconfig*).
```bash
pkg-config xslib --libs --cflags
```

Alternatively, the library can be added via **CMake**:
```cmake
# Find xslib package
find_package ( xslib 2.0.0 REQUIRED )
include_directories ( ${xslib_INCLUDE_DIRS} )
...
# link (shared) xslib library
target_link_libraries ( ${CMAKE_PROJECT_NAME} ${xslib_LIBRARIES} )
# or link STATIC xslib library
target_link_libraries ( ${CMAKE_PROJECT_NAME} ${xslib_STATIC_LIBRARIES} )
```
**NOTE:** In case of non-standard installation path use the following CMake option (with the appropriate value instead of `xxx`):
- `-Dxslib_DIR=xxx` equal to path to `xslib-config.cmake` (default is */usr/local/lib/cmake/xslib-X.X.X/* ).

## [API documentation](doc/README.md)

## [Changelog](doc/CHANGELOG.md)

## Acknowledgments
This library includes modified versions of [libxdrfile](https://github.com/wesbarnett/libxdrfile) and its Fortran wrapper [libgmxfort](https://github.com/wesbarnett/libgmxfort) for reading GROMACS .ndx, .trr, and .xtc files created by [James W. Barnett](https://github.com/wesbarnett).

<!-- Basically, he is my hero. -->

## License
This program is licensed under the **GNU General Public License v3.0**

Copyright (C) 2019-2020 [Jure Cerar](https://github.com/JureCerar)

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
16 changes: 8 additions & 8 deletions cmake/FindPackages.cmake
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Required packages

# OpenMP library
find_package( OpenMP )
if ( OpenMP_FOUND )
list ( APPEND CMAKE_Fortran_FLAGS ${OpenMP_Fortran_FLAGS} )
list ( APPEND CMAKE_C_FLAGS ${OpenMP_C_FLAGS} )
endif ()
## Required packages

# OpenMP library
find_package( OpenMP )
if ( OpenMP_FOUND )
list ( APPEND CMAKE_Fortran_FLAGS ${OpenMP_Fortran_FLAGS} )
list ( APPEND CMAKE_C_FLAGS ${OpenMP_C_FLAGS} )
endif ()
110 changes: 55 additions & 55 deletions cmake/Public.cmake
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
# This file is part of libgmxfort
# https://github.com/wesbarnett/libgmxfort
#
# Copyright (c) 2016,2017 by James W. Barnett
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

set ( EXPORT_INSTALL_DIR "${INSTALL_LIBDIR}/cmake/${PACKAGE_VERSION}" )

include ( CMakePackageConfigHelpers ) # Standard CMake module
write_basic_package_version_file (
"${CMAKE_BINARY_DIR}/${PACKAGE_NAME}-config-version.cmake"
VERSION ${VERSION}
COMPATIBILITY SameMajorVersion
)

# install package config file
configure_package_config_file (
"${CMAKE_SOURCE_DIR}/cmake/pkg/${CMAKE_PROJECT_NAME}-config.cmake.in"
"${CMAKE_BINARY_DIR}/pkg/${PACKAGE_NAME}-config.cmake"
INSTALL_DESTINATION "${EXPORT_INSTALL_DIR}"
PATH_VARS EXPORT_INSTALL_DIR
)

# Install the config and version files so that we can find this project with
# others
install ( FILES
"${CMAKE_BINARY_DIR}/pkg/${PACKAGE_NAME}-config.cmake"
"${CMAKE_BINARY_DIR}/${PACKAGE_NAME}-config-version.cmake"
DESTINATION "${EXPORT_INSTALL_DIR}"
)

# pkg-config
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/${CMAKE_PROJECT_NAME}.pc.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.pc"
@ONLY
)

install ( FILES
"${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.pc"
DESTINATION "${LIBDIR}/pkgconfig"
)
# This file is part of libgmxfort
# https://github.com/wesbarnett/libgmxfort
#
# Copyright (c) 2016,2017 by James W. Barnett
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

set ( EXPORT_INSTALL_DIR "${INSTALL_LIBDIR}/cmake/${PACKAGE_VERSION}" )

include ( CMakePackageConfigHelpers ) # Standard CMake module
write_basic_package_version_file (
"${CMAKE_BINARY_DIR}/${PACKAGE_NAME}-config-version.cmake"
VERSION ${VERSION}
COMPATIBILITY SameMajorVersion
)

# install package config file
configure_package_config_file (
"${CMAKE_SOURCE_DIR}/cmake/pkg/${CMAKE_PROJECT_NAME}-config.cmake.in"
"${CMAKE_BINARY_DIR}/pkg/${PACKAGE_NAME}-config.cmake"
INSTALL_DESTINATION "${EXPORT_INSTALL_DIR}"
PATH_VARS EXPORT_INSTALL_DIR
)

# Install the config and version files so that we can find this project with
# others
install ( FILES
"${CMAKE_BINARY_DIR}/pkg/${PACKAGE_NAME}-config.cmake"
"${CMAKE_BINARY_DIR}/${PACKAGE_NAME}-config-version.cmake"
DESTINATION "${EXPORT_INSTALL_DIR}"
)

# pkg-config
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/${CMAKE_PROJECT_NAME}.pc.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.pc"
@ONLY
)

install ( FILES
"${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.pc"
DESTINATION "${LIBDIR}/pkgconfig"
)
28 changes: 14 additions & 14 deletions cmake/SetVersion.cmake
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Version number is stored in a file .VERSION
file ( STRINGS "${CMAKE_SOURCE_DIR}/.VERSION" VERSION )
string ( REPLACE "." ";" VERSION_LIST ${VERSION} )
list ( GET VERSION_LIST 0 VERSION_MAJOR )
list ( GET VERSION_LIST 1 VERSION_MINOR )
list ( GET VERSION_LIST 2 VERSION_PATCH )
set ( PROJECT_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" )

# Set package name and version
string ( TOLOWER ${CMAKE_PROJECT_NAME} PACKAGE_NAME )
set ( PACKAGE_VERSION "${PACKAGE_NAME}-${VERSION}" )

# Message back
message ( STATUS "CMake build configuration for ${CMAKE_PROJECT_NAME} ${PROJECT_VERSION}" )
# Version number is stored in a file .VERSION
file ( STRINGS "${CMAKE_SOURCE_DIR}/.VERSION" VERSION )
string ( REPLACE "." ";" VERSION_LIST ${VERSION} )
list ( GET VERSION_LIST 0 VERSION_MAJOR )
list ( GET VERSION_LIST 1 VERSION_MINOR )
list ( GET VERSION_LIST 2 VERSION_PATCH )
set ( PROJECT_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" )

# Set package name and version
string ( TOLOWER ${CMAKE_PROJECT_NAME} PACKAGE_NAME )
set ( PACKAGE_VERSION "${PACKAGE_NAME}-${VERSION}" )

# Message back
message ( STATUS "CMake build configuration for ${CMAKE_PROJECT_NAME} ${PROJECT_VERSION}" )
Loading

0 comments on commit 42cd696

Please sign in to comment.