Skip to content

Commit

Permalink
Release 2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
JureCerar committed Jan 17, 2020
1 parent 2638db5 commit 96dafcc
Show file tree
Hide file tree
Showing 85 changed files with 13,611 additions and 14,716 deletions.
2 changes: 1 addition & 1 deletion .VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.0-alpha
2.1.0
11 changes: 3 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,12 @@ project ( xslib C Fortran )
# Add /cmake subdirectory
list ( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" )

# Set project Info, make Public, set Version and define Compiler flags
# Set project find packages, define Compiler flagsInfo, set Version, and make Public.
include ( FindPackages )
include ( SetCompilerFlags )
include ( SetVersion )
include ( Info )
include ( Public )
include ( SetCompilerFlags )

# Look for dependencies
# include ( Dependencies )

# Setup the LAPACK libraries.
# include( SetUpLAPACK.cmake )

# Main build script
add_subdirectory ( src )
Expand Down
39 changes: 17 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# XsLib - Extra-Small Library
# xslib - Extra-Small Library

[![GitHub version](https://img.shields.io/github/release/JureCerar/xslib.svg?label=Version&color=blue)](https://github.com/JureCerar/xslib/releases)
![Language](https://img.shields.io/badge/Language-Fortran,_C-brightgreen.svg)
![Dependencies](https://img.shields.io/badge/Dependencies-None-brightgreen.svg)
[![License](https://img.shields.io/badge/License-GNU_GPL_v3.0-red.svg)](https://www.gnu.org/licenses/gpl-3.0.html)
<!-- [![Generic badge](https://img.shields.io/badge/<SUBJECT>-<STATUS>-<COLOR>.svg)](https://shields.io/) -->

## Synopsis
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. The library features functions to handle standard molecular coordinate files (**.gro**, **.pdb**, and **.xyz**), trajectory files (**.trr** and **.xtc**), supporting files (**.ndx** and **.tpl**), and data files (**.csv** and **.pdh**). 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 Extra-Small Library (xslib) is a modern Fortran library consisting of useful utilities and functions that "computer chemist" might need during his/her work. The library features functions to handle standard molecular coordinate files (**.gro**, **.pdb**, **.cub**, and **.xyz**), trajectory files (**.dcd** and **.xtc**), supporting files (**.ndx** and **.tpl**), and data files (**.csv** and **.pdh**). 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.

## Build & Install
Clone or download repository from GitHub:
Expand All @@ -20,7 +19,7 @@ mkdir build
cd build
cmake ..
make
make test
make check
```
To install library type the following as *root* (or *sudo*):
```bash
Expand All @@ -34,52 +33,48 @@ You should consider using the following [CMake options](https://cmake.org/cmake/

## Usage
On how to interface with the xslib library, please read [API documentation](doc/API.md) below.

To use the library always put `use xslib` in the module section:
To use the library put `use xslib` in the module section of your program:
```fortran
program main
use xslib
implicit none
! ...
use xslib
implicit none
! ...
end program main
```

and use `-lxslib` flag when compiling your program. 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*).
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 1.0.0 REQUIRED )
# Find xslib package
find_package ( xslib 2.0.0 REQUIRED )
include_directories ( ${xslib_INCLUDE_DIRS} )
...
# Link XsLib package
# Link xslib library
target_link_libraries ( ${CMAKE_PROJECT_NAME} ${xslib_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/* ).

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.Y.Z/* ).

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

## [Changelog](CHANGELOG.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).
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 [Jure Cerar](https://github.com/JureCerar)
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.

Expand Down
8 changes: 8 additions & 0 deletions cmake/FindPackages.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Required packages

# OpenMP library
find_package( OpenMP )
if ( OpenMP_FOUND )
set( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${OpenMP_Fortran_FLAGS}")
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
endif ()
6 changes: 3 additions & 3 deletions cmake/Info.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Set PKG-CONFIG package information
set ( PROJECT_DESCRIPTION "Fortran library for reading molecular files." )
set ( PROJECT_DESCRIPTION "Fortran library with useful I/O utilities and functions." )
set ( PROJECT_URL "https://github.com/JureCerar/xslib" )
set ( LIBDIR "lib")
set ( INCLUDEDIR "include")
set ( LIBDIR "lib" )
set ( INCLUDEDIR "include" )
set ( INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX}/${LIBDIR} )
set ( INSTALL_INCLUDEDIR ${CMAKE_INSTALL_PREFIX}/${INCLUDEDIR} )
1 change: 0 additions & 1 deletion cmake/Public.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#
# This file is part of libgmxfort
# https://github.com/wesbarnett/libgmxfort
#
Expand Down
45 changes: 16 additions & 29 deletions cmake/SetCompilerFlags.cmake
Original file line number Diff line number Diff line change
@@ -1,34 +1,21 @@
# Default build type
## Define default build type
if ( NOT CMAKE_BUILD_TYPE )
set ( CMAKE_BUILD_TYPE RELEASE CACHE STRING "Build configuration 'Release' or 'Debug'." FORCE )
message ( STATUS "CMAKE_BUILD_TYPE not given, defaulting to RELEASE." )
set ( CMAKE_BUILD_TYPE "RELEASE" CACHE STRING "Build configuration 'RELEASE' or 'DEBUG'." FORCE )
message ( STATUS "CMAKE_BUILD_TYPE not given, defaulting to RELEASE.")
else ()
message ( STATUS "CMAKE_BUILD_TYPE is: ${CMAKE_BUILD_TYPE}" )
message ( STATUS "CMAKE_BUILD_TYPE is: ${CMAKE_BUILD_TYPE}")
endif ()

# Compiler options
IF ( ${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU" )
set ( CMAKE_Fortran_FLAGS "-cpp -fopenmp" )
set ( CMAKE_Fortran_FLAGS_RELEASE "-O3 -march=native -pipe -funroll-loops -finline-functions -flto" )
set ( CMAKE_Fortran_FLAGS_DEBUG "-Og -g -fbounds-check -fbacktrace -ffpe-trap=invalid,zero,overflow,underflow" )

ELSEIF ( ${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel" )
set ( CMAKE_Fortran_FLAGS "-fpp -openmp" )
set ( CMAKE_Fortran_FLAGS_RELEASE "-O3 -FR -xHost -ipo -ip -unroll -vec-report0 -trace" )
set ( CMAKE_Fortran_FLAGS_DEBUG "-O1 -g -C -traceback -check all -debug all -fpe-model strict -fpe-all=0 –no-ftz" )

ELSEIF ( ${CMAKE_Fortran_COMPILER_ID} STREQUAL "PGI" )
set ( CMAKE_Fortran_FLAGS "-mp" )
set ( CMAKE_Fortran_FLAGS_RELEASE "-O3 -Munroll -Mipa -Minline -Mvect" )
set ( CMAKE_Fortran_FLAGS_DEBUG "-O1 -g -C -Mbounds -Mchkptr -Mchkstk -traceback -Ktrap=fp –Minform=inform")

ENDIF ()


# Message back flags ()
IF ( ${CMAKE_BUILD_TYPE} STREQUAL "DEBUG" )
message ( STATUS "CMAKE_Fortran_FLAGS: ${CMAKE_Fortran_FLAGS}" )
message ( STATUS "CMAKE_Fortran_FLAGS_RELEASE: ${CMAKE_Fortran_FLAGS_RELEASE}" )
message ( STATUS "CMAKE_Fortran_FLAGS_DEBUG: ${CMAKE_Fortran_FLAGS_DEBUG}" )
## FORTRAN Compiler
if ( ${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU" )
set ( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -march=native" )
set ( CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -fexcess-precision=fast -funroll-loops -finline-functions" )
set ( CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -Og -Wall -fcheck=all -fbacktrace" )
endif ()

ENDIF ()
## C Compiler
if ( ${CMAKE_C_COMPILER_ID} STREQUAL "GNU" )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native" )
set ( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fexcess-precision=fast -funroll-loops -finline-functions" )
set ( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Og -Wall" )
endif ()
Loading

0 comments on commit 96dafcc

Please sign in to comment.