Skip to content

Commit

Permalink
Merge pull request #341 from sys-bio/develop
Browse files Browse the repository at this point in the history
Merge into master for 1.4.8 rel
  • Loading branch information
0u812 authored Aug 9, 2016
2 parents f542692 + 2675576 commit 611bd53
Show file tree
Hide file tree
Showing 64 changed files with 1,659 additions and 851 deletions.
87 changes: 85 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ project(rr)

set(ROADRUNNER_VERSION_MAJOR 1)
set(ROADRUNNER_VERSION_MINOR 4)
set(ROADRUNNER_VERSION_PATCH 2)
set(ROADRUNNER_VERSION_PATCH 8)

set(ROADRUNNER_VERSION "${ROADRUNNER_VERSION_MAJOR}.${ROADRUNNER_VERSION_MINOR}.${ROADRUNNER_VERSION_PATCH}")

Expand Down Expand Up @@ -91,6 +91,9 @@ option(BUILD_LEGACY_C "Build the legacy C code generating backend (deprecated)")
# should we build the swig python wrapper?
option (BUILD_PYTHON "build the SWIG generated python wrapper" OFF)
set( PYTHON_SITE_DIR site-packages CACHE PATH "Path to Python site packages directory" )
if(BUILD_PYTHON)
set(PYTHON_PACKAGE_DEST_DIR ${PYTHON_SITE_DIR}/roadrunner)
endif()

# should we build the swig Java wrapper?
option (BUILD_JAVA_INTERFACE "build the SWIG generated Java wrapper" OFF)
Expand Down Expand Up @@ -133,6 +136,7 @@ OPTION (INSTALL_STATIC_LIB "Install RoadRunner CXX static lib"
OPTION (RR_BUILD_SHARED_CORE "Build RoadRunner Core Shared library" ON)
OPTION (BUILD_TESTS "Build the SBML C API test suite" OFF)
OPTION (INSTALL_SBML_MODELS "Install SBML Models" ON )
OPTION (WITH_CONDA_BUILDER "Include files required to build the conda package" OFF)

#Setup so that roadrunner is always built as a dll and linked statically with 'as much as possible'
set(BUILD_SHARED_LIBS ON)
Expand Down Expand Up @@ -201,8 +205,36 @@ else()
find_package(LibXml2 REQUIRED)
message(STATUS "found libxml2, include dir: ${LIBXML2_INCLUDE_DIR}")
include_directories(${LIBXML2_INCLUDE_DIR})
endif(WIN32)
endif()

find_library(LIBSBML_LIBRARY sbml libsbml HINTS ${THIRD_PARTY_INSTALL_FOLDER}/lib)
find_library(LIBSBML_STATIC_LIBRARY sbml-static libsbml-static HINTS ${THIRD_PARTY_INSTALL_FOLDER}/lib)
find_path(LIBSBML_INCLUDE_DIR sbml/SBMLTypes.h HINTS ${THIRD_PARTY_INSTALL_FOLDER}/include)

# find libSBML deps

if(WIN32)
find_library(ICONV_LIBRARY iconv libiconv HINTS ${THIRD_PARTY_INSTALL_FOLDER}/lib)
if(NOT ICONV_LIBRARY)
message(SEND_ERROR "Could not find libiconv, required for libSBML linking")
endif()
endif()
message(STATUS "ZLIB SDK dir: ${CMAKE_OSX_SYSROOT}/usr/lib")
find_library(ZLIB_LIBRARY NAMES z libz libz.dylib zdll HINTS ${THIRD_PARTY_INSTALL_FOLDER}/lib ${CMAKE_OSX_SYSROOT}/usr/lib)
message(STATUS "Find ZLIB results: ${ZLIB_LIBRARY}")
if(NOT ZLIB_LIBRARY)
message(SEND_ERROR "Could not find zlib, required for libSBML linking")
endif()
find_library(BZ2_LIBRARY bz2 libbz2 HINTS ${THIRD_PARTY_INSTALL_FOLDER}/lib)
if(NOT BZ2_LIBRARY)
message(SEND_ERROR "Could not find libbz2, required for libSBML linking")
endif()

if(WIN32)
set(LIBSBML_EXTRA_LIBS "${ICONV_LIBRARY};${ZLIB_LIBRARY};${BZ2_LIBRARY}" CACHE STRING "libSBML extra libraries")
else()
set(LIBSBML_EXTRA_LIBS "${ZLIB_LIBRARY};${BZ2_LIBRARY}" CACHE STRING "libSBML extra libraries")
endif()

if (${BUILD_LLVM})
link_directories(
Expand Down Expand Up @@ -284,6 +316,44 @@ else()
message(STATUS "not building legacy C backend")
endif(BUILD_LEGACY_C)

message(STATUS "
-------------------------------------------------------------------------------
libRoadRunner Configuration Summary
-------------------------------------------------------------------------------
For up-to-date news and releases visit libroadrunner.org
Configured on host $ENV{COMPUTERNAME} ${HOSTNAME}
host OS ${CMAKE_SYSTEM_NAME}
host architecture ${CMAKE_SYSTEM_PROCESSOR}
General flags:
CC ${CMAKE_C_COMPILER}
CXX ${CMAKE_CXX_COMPILER}
CPPFLAGS ${BUILD_DEFINITIONS}
CFLAGS ${CMAKE_C_FLAGS}
CXXFLAGS ${CMAKE_CXX_FLAGS}
LDFLAGS ${CMAKE_EXE_LINKER_FLAGS}
Installation prefix: ${CMAKE_INSTALL_PREFIX}
Options:
With LLVM? ${BUILD_LLVM}
With legacy C? (DEP) ${BUILD_LEGACY_C}
Enable Python interface? ${BUILD_PYTHON}
Enable Java interface? ${BUILD_JAVA_INTERFACE}
Enable test suite? ${BUILD_TESTS}
Dependencies (packages marked with *** are required):
"
)

message( " *** libSBML")
message( " libSBML libs ${LIBSBML_LIBRARY}")
message( " libSBML static libs ${LIBSBML_STATIC_LIBRARY}")
message( " libSBML includes ${LIBSBML_INCLUDE_DIR}")

message( "" )

# We alway have to build the roadrunner core, everything depends on this
add_subdirectory(source)
Expand Down Expand Up @@ -314,6 +384,8 @@ if(BUILD_TESTS AND BUILD_TEST_TOOLS)

file(GLOB PYTHON_TEST_DATA "${CMAKE_CURRENT_SOURCE_DIR}/testing/*.rrtest")

file(GLOB TEST_DATA_XML "${CMAKE_CURRENT_SOURCE_DIR}/testing/*.xml")

foreach( f ${TEST_FILES} )
if(NOT IS_DIRECTORY ${f})
get_filename_component( FILE_NAME ${f} NAME )
Expand All @@ -329,6 +401,13 @@ if(BUILD_TESTS AND BUILD_TEST_TOOLS)
endif()
endforeach()

foreach( f ${TEST_DATA_XML} )
if(NOT IS_DIRECTORY ${f})
get_filename_component( FILE_NAME ${f} NAME )
configure_file( ${f} lib/site-packages/roadrunner/testing/test_data/${FILE_NAME} COPYONLY )
endif()
endforeach()

add_subdirectory(testing)
add_subdirectory(autotest)
else()
Expand Down Expand Up @@ -383,3 +462,7 @@ if(WIN32)
FILES win32_bin_README.txt DESTINATION bin/ RENAME README.txt
)
endif(WIN32)

if(WITH_CONDA_BUILDER)
install(FILES assets/roadrunner-64x64-red.png DESTINATION assets)
endif()
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
[![GitHub version](https://badge.fury.io/gh/sys-bio%2Froadrunner.svg)](http://badge.fury.io/gh/sys-bio%2Froadrunner)
[![Build Status](https://travis-ci.org/sys-bio/roadrunner.svg?branch=develop)](https://travis-ci.org/sys-bio/roadrunner)

Copyright 2013-2015
Copyright 2013-2016

E. T. Somogyi <sup>1</sup>, M. T. Karlsson <sup>2</sup>, M. Swat <sup>1</sup>, M. Galdzicki <sup>3</sup>, J. K. Medley <sup>3</sup>, K. Choi <sup>3</sup>, W. Copeland <sup>3</sup> and H. M. Sauro <sup>3</sup>
E. T. Somogyi <sup>1</sup>, J. K. Medley <sup>3</sup>, M. T. Karlsson <sup>2</sup>, M. Swat <sup>1</sup>, M. Galdzicki <sup>3</sup>, K. Choi <sup>3</sup>, W. Copeland <sup>3</sup> and H. M. Sauro <sup>3</sup>

1. Biocomplexity Institute, Indiana University, Simon Hall MSB1, Bloomington, IN 47405
2. Dune Scientific, 10522 Lake City Way NE, #302 Seattle WA
Expand Down
2 changes: 1 addition & 1 deletion apps/rr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ rr-libstruct-static
lapack
blas
f2c
sbml-static.a
${LIBSBML_STATIC_LIBRARY}
xml2
sundials_nvecserial.a
sundials_cvode.a
Expand Down
Binary file added assets/roadrunner-64x64-red.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions packaging/deb/libroadrunner/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
libroadrunner (1.4.2) unstable; urgency=low

* Bufix release

-- Kyle Medley <[email protected]> Fri, 29 Jan 2016 12:00:00 -0700

libroadrunner (1.4.1) unstable; urgency=low

* Refactored solver API
Expand Down
2 changes: 1 addition & 1 deletion packaging/deb/libroadrunner/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Description: Simulation library for SBML
Package: libroadrunner
Section: libs
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, libroadrunner-deps (= ${binary:Version})
Depends: ${shlibs:Depends}, ${misc:Depends}, libroadrunner-deps (>= 2.0.2)
Description: Simulation library for SBML
libRoadRunner is a ODE/stochastic simulation and
modeling environment for SBML
21 changes: 13 additions & 8 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -248,17 +248,19 @@ if(RR_BUILD_SHARED_CORE)
if(UNIX)
target_link_libraries (${target}
pthread
sbml-static
${LIBSBML_STATIC_LIBRARY}
dl
f2c${staticLibExt}
)
target_link_libraries(${target} ${LIBSBML_EXTRA_LIBS})
else()
target_link_libraries (${target}
libf2c
libsbml
ws2_32
iphlpapi
${LIBSBML_LIBRARY}
ws2_32
iphlpapi
)
target_link_libraries(${target} ${LIBSBML_EXTRA_LIBS})
endif(UNIX)


Expand All @@ -276,6 +278,7 @@ if(RR_BUILD_SHARED_CORE)
LIBRARY DESTINATION lib COMPONENT rr_core
ARCHIVE DESTINATION lib COMPONENT rr_core
)
install(TARGETS roadrunner DESTINATION ${PYTHON_PACKAGE_DEST_DIR})
endif()


Expand Down Expand Up @@ -329,22 +332,24 @@ target_link_libraries (${target}-static

if(WIN32)
target_link_libraries (${target}-static
libsbml-static
${LIBSBML_STATIC_LIBRARY}
libf2c
ws2_32
iphlpapi
ws2_32
iphlpapi
)
target_link_libraries(${target}-static ${LIBSBML_EXTRA_LIBS})
endif(WIN32)


if(UNIX)
target_link_libraries (${target}-static
sbml-static
${LIBSBML_STATIC_LIBRARY}
f2c
xml2
dl
pthread
)
target_link_libraries(${target}-static ${LIBSBML_EXTRA_LIBS})
endif(UNIX)

#Libxml we can't build right now
Expand Down
4 changes: 1 addition & 3 deletions source/CVODEIntegrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ namespace rr
}
else if (key == "absolute_tolerance" || key == "relative_tolerance")
{
CVodeSetMaxNumSteps(mCVODE_Memory, getValueAsInt("maximum_num_steps"));
CVodeSetMaxNumSteps(mCVODE_Memory, getValueAsInt("maximum_num_steps")); // FIXME: is this intentional?
setCVODETolerances();
}
}
Expand Down Expand Up @@ -1043,5 +1043,3 @@ namespace rr
}

}


18 changes: 14 additions & 4 deletions source/GillespieIntegrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ namespace rr

// Set default integrator settings.
addSetting("seed", defaultSeed(), "Seed", "Set the seed into the random engine. (ulong)", "(ulong) Set the seed into the random engine.");
addSetting("variable_step_size",false, "Variable Step Size", "Perform a variable time step simulation. (bool)", "(bool) Enabling this setting will allow the integrator to adapt the size of each time step. This will result in a non-uniform time column.");
addSetting("variable_step_size",true, "Variable Step Size", "Perform a variable time step simulation. (bool)", "(bool) Enabling this setting will allow the integrator to adapt the size of each time step. This will result in a non-uniform time column.");
addSetting("initial_time_step", 0.0, "Initial Time Step", "Specifies the initial time step size. (double)", "(double) Specifies the initial time step size.");
addSetting("minimum_time_step", 0.0, "Minimum Time Step", "Specifies the minimum absolute value of step size allowed. (double)", "(double) The minimum absolute value of step size allowed.");
addSetting("maximum_time_step", 0.0, "Maximum Time Step", "Specifies the maximum absolute value of step size allowed. (double)", "(double) The maximum absolute value of step size allowed.");
Expand All @@ -205,14 +205,20 @@ namespace rr
{
double tf = 0;
bool singleStep;
bool varStep = getValue("variable_step_size").convert<bool>();
double minTimeStep = getValue("minimum_time_step").convert<double>();

assert(hstep > 0 && "hstep must be > 0");

if (getValue("variable_step_size").convert<bool>())
if (varStep)
{
if (getValue("minimum_time_step").convert<double>() > 0.0)
if (minTimeStep > 0.0)
{
tf = t + getValue("minimum_time_step").convert<double>();
if (minTimeStep > hstep) // no step bigger than hstep
{
minTimeStep = hstep;
}
tf = t + minTimeStep;
singleStep = false;
}
else
Expand Down Expand Up @@ -273,6 +279,10 @@ namespace rr
// no reaction occurs
return std::numeric_limits<double>::infinity();
}
if (t + tau > tf) // if time exhausted, don't allow reaction to proceed
{
return tf;
}

t = t + tau;

Expand Down
3 changes: 2 additions & 1 deletion source/Integrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ namespace rr
{
std::stringstream ss;
ss << "< roadrunner.Integrator() >\n";
ss << " name: " << getName() << "\n";
ss << " settings:\n";
ss << getSettingsRepr();
return ss.str();
Expand All @@ -57,7 +58,7 @@ namespace rr
std::string Integrator::toRepr() const
{
std::stringstream ss;
ss << "< roadrunner.Integrator() " << settingsPyDictRepr() << " >\n";
ss << "< roadrunner.Integrator() \"" << getName() << "\" " << settingsPyDictRepr() << " >\n";
return ss.str();
}

Expand Down
4 changes: 2 additions & 2 deletions source/NLEQSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ std::string NLEQSolver::getNLEQHint() {
return "Steady-state nonlinear systems of equations solver";
}

double NLEQSolver::solve(const vector<double>& yin)
double NLEQSolver::solve()
{
Log(Logger::LOG_DEBUG) << "NLEQSolver::solve";

Expand All @@ -90,7 +90,7 @@ double NLEQSolver::solve(const vector<double>& yin)
// nleq->relativeTolerance = getValue("relative_tolerance");
// nleq->minDamping = getValue("minimum_damping");

double result = nleq->solve(yin);
double result = nleq->solve();
delete nleq;
return result;
}
Expand Down
2 changes: 1 addition & 1 deletion source/NLEQSolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class RR_DECLSPEC NLEQSolver : public SteadyStateSolver
static std::string getNLEQHint();

// ** Solver routines
double solve(const vector<double>& yin);
double solve();

private:
ExecutableModel *model; // Model generated from the SBML. Static so we can access it from standalone function
Expand Down
25 changes: 23 additions & 2 deletions source/SBMLValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,29 @@ static bool isStoichDefined(const SpeciesReference* s) {
bool isStoichDefined(const std::string sbml) {
SBMLDocument *doc = NULL;

if(sbml.substr(0,5) != "<?xml")
throw std::runtime_error("SBML document must begin with an XML declaration");
bool sbml_decl_okay = false;

// check for <?xml
size_t pos = sbml.find("<");
if (pos != std::string::npos) {
pos = sbml.find("?", pos+1);
if (pos != std::string::npos) {
pos = sbml.find("xml", pos+1);
if (pos != std::string::npos)
sbml_decl_okay = true;
}
}

// check for <sbml
pos = sbml.find("<");
if (pos != std::string::npos) {
pos = sbml.find("sbml", pos+1);
if (pos != std::string::npos)
sbml_decl_okay = true;
}

if (!sbml_decl_okay)
throw std::runtime_error("SBML document must begin with an XML declaration or an SBML declaration");

try {
doc = readSBMLFromString (sbml.c_str());
Expand Down
3 changes: 2 additions & 1 deletion source/Solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ namespace rr
{
std::stringstream ss;
ss << "< roadrunner.Solver() >\n";
ss << " name: " << getName() << "\n";
ss << " settings:\n";
ss << getSettingsRepr();
return ss.str();
Expand All @@ -215,7 +216,7 @@ namespace rr
std::string Solver::toRepr() const
{
std::stringstream ss;
ss << "< roadrunner.Solver() " << settingsPyDictRepr() << " >\n";
ss << "< roadrunner.Solver() \"" << getName() << "\" " << settingsPyDictRepr() << " >\n";
return ss.str();
}
}
Loading

0 comments on commit 611bd53

Please sign in to comment.