diff --git a/bionetgen.spec b/bionetgen.spec index 680ef36..5f6ac75 100644 --- a/bionetgen.spec +++ b/bionetgen.spec @@ -8,6 +8,10 @@ URL: https://github.com/RuleWorld/bionetgen Source0: https://github.com/RuleWorld/bionetgen/archive/BioNetGen-%{version}.tar.gz#/bionetgen-BioNetGen-%{version}.tar.gz Patch0: bionetgen-isnan.patch +# patch based on example in +# http://sundials.2283335.n4.nabble.com/Usage-notes-lead-to-the-example-that-uses-the-non-existent-header-cvode-cvode-dense-h-td4654260.html +Patch1: network-solver.diff + BuildRequires: muParser-devel >= 2.2.3-6 BuildRequires: perl-generators BuildRequires: sundials-devel diff --git a/network-solver.diff b/network-solver.diff new file mode 100644 index 0000000..3fcf2bf --- /dev/null +++ b/network-solver.diff @@ -0,0 +1,63 @@ +diff --git var/lib/mock/fedora-rawhide-x86_64/root/builddir/build/BUILD/bionetgen-BioNetGen-2.3.0/bng2/Network3/src/network.cpp.orig var/lib/mock/fedora-rawhide-x86_64/root/builddir/build/BUILD/bionetgen-BioNetGen-2.3.0/bng2/Network3/src/network.cpp +index a53a138ae7..b437797ca9 100644 +--- bionetgen-BioNetGen-2.3.0/bng2/Network3/src/network.cpp.orig ++++ bionetgen-BioNetGen-2.3.0/bng2/Network3/src/network.cpp +@@ -2627,14 +2627,17 @@ int print_rates_network(FILE* out, int discrete) { + + #include "sundials/sundials_types.h" + #include "cvode/cvode.h" ++#include "cvode/cvode_direct.h" + #include "nvector/nvector_serial.h" + +-#include "cvode/cvode_dense.h" + #include "sundials/sundials_dense.h" + #include "sundials/sundials_direct.h" ++#include "sunmatrix/sunmatrix_sparse.h" ++ ++#include "sunlinsol/sunlinsol_dense.h" ++#include "sunlinsol/sunlinsol_spgmr.h" ++ + +-#include "cvode/cvode_spgmr.h" +-#include "sundials/sundials_spgmr.h" + + typedef struct jacnode* jacnode_ref; + +@@ -2986,6 +2989,8 @@ int propagate_cvode_network(double* t, double delta_t, double* n_steps, double* + static N_Vector y; + static void* cvode_mem; + static int initflag = 0; ++ static SUNMatrix A; ++ static SUNLinearSolver LS; + long int cvode_maxnumsteps = 2000; + + /* Initializations at the beginning of new propagation */ +@@ -3018,18 +3023,26 @@ int propagate_cvode_network(double* t, double delta_t, double* n_steps, double* + * Jacobian vs finite difference + */ + if (SOLVER == GMRES || SOLVER == GMRES_J) { +- CVSpgmr(cvode_mem, PREC_NONE, 0); + if (SOLVER == GMRES_J) { + cout << "ERROR: Jacobian no longer supported for GMRES solver" << endl; + exit(1); + } ++ ++ // CVSpgmr(cvode_mem, PREC_NONE, 0); ++ A = SUNSparseMatrix(n_species, n_species, 0, CSC_MAT); ++ LS = SUNSPGMR(y, PREC_NONE, 0); ++ CVDlsSetLinearSolver(cvode_mem, LS, A); + } + else if (SOLVER == DENSE || SOLVER == DENSE_J) { +- CVDense(cvode_mem, n_species); + if (SOLVER == DENSE_J) { + cout << "ERROR: Jacobian no longer supported for dense solver" << endl; + exit(1); + } ++ ++ // CVDense(cvode_mem, n_species); ++ A = SUNDenseMatrix(n_species, n_species); ++ LS = SUNDenseLinearSolver(y, A); ++ CVDlsSetLinearSolver(cvode_mem, LS, A); + } + else { + fprintf(stderr, "ERROR: Invalid CVODE solver.\n");