Running 'testthat.R' [45s/50s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
  > library(testthat)
  > library(CHNOSZ)
  CHNOSZ version 1.3.3 (2019-08-02)
  reset: creating "thermo" object
  obigt: loading default database with 1849 aqueous, 3372 total species
  > 
  > # as fix for https://github.com/hadley/testthat/issues/129, https://github.com/hadley/testthat/issues/144
  > # (since we use makeCluster() etc via palply)
  > Sys.setenv("R_TESTS" = "") 
  > 
  > test_check("CHNOSZ")
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2: basis(species, logact)
  where 3: preset.basis(species[1])
  where 4 at testthat/test-affinity.R#10: basis("CHNOS")
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test-affinity.R#6: test_that("errors come as expected", {
      expect_error(affinity(iprotein = 7), "basis species are not defined")
      expect_error(affinity(iprotein = NA), "has some NA values")
      expect_error(affinity(iprotein = 0), "are not rownumbers")
      basis("CHNOS")
      expect_error(affinity(), "species have not been defined")
      species("CO2")
      expect_error(affinity(pe = c(-10, 10), pH = c(0, 14)), "pe.*does not match any basis species")
      expect_error(affinity(O2 = c(-80, -60), pH = c(0, 14)), "pH.*does not match any basis species")
  })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 43: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 44: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 1. Error: errors come as expected (@test-affinity.R#10)  --------------------
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis("CHNOS")
   2. CHNOSZ:::preset.basis(species[1])
   3. CHNOSZ::basis(species, logact)
   4. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2: basis(species, logact)
  where 3: preset.basis(species[1])
  where 4 at testthat/test-affinity.R#18: basis("CHNOS")
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test-affinity.R#17: test_that("output gives T and P in user's units", {
      basis("CHNOS")
      species("5a(H),14b(H)-cholestane")
      a.C_bar <- affinity(T = c(0, 100, 10), P = c(10, 1000, 10))
      expect_equal(range(a.C_bar$vals[[1]]), c(0, 100))
      expect_equal(range(a.C_bar$vals[[2]]), c(10, 1000))
      T.units("K")
      P.units("MPa")
      a.K_MPa <- affinity(T = c(273.15, 373.15, 10), P = c(1, 100, 
          10))
      expect_equal(range(a.K_MPa$vals[[1]]), c(273.15, 373.15))
      expect_equal(range(a.K_MPa$vals[[2]]), c(1, 100))
      expect_equal(a.C_bar$values, a.K_MPa$values)
      T.units("C")
      P.units("bar")
  })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 43: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 44: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 2. Error: output gives T and P in user's units (@test-affinity.R#18)  -------
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis("CHNOS")
   2. CHNOSZ:::preset.basis(species[1])
   3. CHNOSZ::basis(species, logact)
   4. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2: basis(species, logact)
  where 3: preset.basis(species[1])
  where 4 at testthat/test-affinity.R#36: basis("CHNOSe")
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test-affinity.R#35: test_that("pe, pH and Eh are correctly handled", {
      basis("CHNOSe")
      species(c("HS-", "H2S", "SO4-2"))
      Eh <- c(-1, 1)
      pe <- convert(Eh, "pe", T = convert(100, "K"))
      a.Eh <- affinity(Eh = Eh, T = 100)
      a.pe <- affinity(pe = pe, T = 100)
      expect_equal(a.Eh$values, a.pe$values, check.attributes = FALSE)
      expect_equal(c(a.Eh$vars, a.pe$vars), c("Eh", "pe"))
      pH <- c(0, 14)
      a <- affinity(pH = pH, Eh = Eh)
      expect_equal(a$vars, c("pH", "Eh"))
      expect_equal(range(a$vals[[1]]), pH)
      expect_equal(range(a$vals[[2]]), Eh)
      expect_equal(length(a$vals[[2]]), 128)
      a129 <- affinity(pH = pH, Eh = c(Eh, 129))
      expect_equal(length(a129$vals[[2]]), 129)
  })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 43: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 44: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 3. Error: pe, pH and Eh are correctly handled (@test-affinity.R#36)  --------
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis("CHNOSe")
   2. CHNOSZ:::preset.basis(species[1])
   3. CHNOSZ::basis(species, logact)
   4. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2 at testthat/test-affinity.R#77: basis(c("H2", "O2"), "aq")
  where 3: eval(code, test_env)
  where 4: eval(code, test_env)
  where 5: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 6: doTryCatch(return(expr), name, parentenv, handler)
  where 7: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 8: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 11: tryCatchList(expr, classes, parentenv, handlers)
  where 12: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 13: test_code(desc, code, env = parent.frame())
  where 14 at testthat/test-affinity.R#66: test_that("affinity() in 3D returns values consistent with manual calculation", 
      {
          logK.25 <- subcrt(c("H2", "O2", "H2O"), "aq", c(-1, -0.5, 
              1), T = 25)$out$logK
          logK.100 <- subcrt(c("H2", "O2", "H2O"), "aq", c(-1, 
              -0.5, 1), T = 100)$out$logK
          A.2303RT.25.10.10 <- logK.25 - ((-1) * (-10) + (-0.5) * 
              (-10))
          A.2303RT.100.5.10 <- logK.100 - ((-1) * (-5) + (-0.5) * 
              (-10))
          basis(c("H2", "O2"), "aq")
          species("H2O")
          a.logK <- affinity(T = c(0, 125, 6), H2 = c(-20, 0, 5), 
              O2 = c(-20, 0, 5), property = "logK")
          expect_equal(dim(a.logK$values[[1]]), c(6, 5, 5), check.names = FALSE)
          expect_equal(a.logK$values[[1]][2, 3, 3], logK.25)
          expect_equal(a.logK$values[[1]][5, 4, 3], logK.100)
          a.A <- affinity(T = c(0, 125, 6), H2 = c(-20, 0, 5), 
              O2 = c(-20, 0, 5))
          expect_equal(a.A$values[[1]][2, 3, 3], A.2303RT.25.10.10)
          expect_equal(a.A$values[[1]][5, 4, 3], A.2303RT.100.5.10)
      })
  where 15: eval(code, test_env)
  where 16: eval(code, test_env)
  where 17: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 18: doTryCatch(return(expr), name, parentenv, handler)
  where 19: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 20: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 23: tryCatchList(expr, classes, parentenv, handlers)
  where 24: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 25: test_code(NULL, exprs, env)
  where 26: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 27: force(code)
  where 28: doWithOneRestart(return(expr), restart)
  where 29: withOneRestart(expr, restarts[[1L]])
  where 30: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 31: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 32: FUN(X[[i]], ...)
  where 33: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 34: force(code)
  where 35: doWithOneRestart(return(expr), restart)
  where 36: withOneRestart(expr, restarts[[1L]])
  where 37: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 38: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 39: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 40: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 41: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 4. Error: affinity() in 3D returns values consistent with manual calculation 
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis(c("H2", "O2"), "aq")
   2. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2 at testthat/test-affinity.R#108: basis(c("HCO3-", "H2O", "NH3", "HS-", "H2", "H+"), "aq", c(-3, 
      0, -4, -7, 999, 999))
  where 3: eval(code, test_env)
  where 4: eval(code, test_env)
  where 5: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 6: doTryCatch(return(expr), name, parentenv, handler)
  where 7: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 8: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 11: tryCatchList(expr, classes, parentenv, handlers)
  where 12: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 13: test_code(desc, code, env = parent.frame())
  where 14 at testthat/test-affinity.R#95: test_that("'iprotein' gives consistent results on a transect", 
      {
          A.2303RT_ref <- c(-18.72, -27.894, -35.276, -36.657, 
              -41.888)
          T <- c(93.3, 79.4, 67.5, 65.3, 57.1)
          pH <- c(7.35, 7.678, 7.933, 7.995, 8.257)
          H2 <- -11 + T * 3/40
          reset()
          basis(c("HCO3-", "H2O", "NH3", "HS-", "H2", "H+"), "aq", 
              c(-3, 0, -4, -7, 999, 999))
          sites <- c("N", "S", "R", "Q", "P")
          file <- system.file("extdata/protein/DS11.csv", package = "CHNOSZ")
          aa <- read.csv(file, as.is = TRUE)
          ip <- add.protein(aa[1:5, ])
          add.obigt("OldAA")
          a <- affinity(T = T, pH = pH, H2 = H2, iprotein = ip)
          pl <- protein.length(ip)
          A.2303RT <- t(sapply(a$values, c))/pl
          A.2303RT_max <- apply(A.2303RT, 2, max)
          expect_equal(A.2303RT_max, A.2303RT_ref, tolerance = 0.001)
      })
  where 15: eval(code, test_env)
  where 16: eval(code, test_env)
  where 17: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 18: doTryCatch(return(expr), name, parentenv, handler)
  where 19: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 20: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 23: tryCatchList(expr, classes, parentenv, handlers)
  where 24: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 25: test_code(NULL, exprs, env)
  where 26: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 27: force(code)
  where 28: doWithOneRestart(return(expr), restart)
  where 29: withOneRestart(expr, restarts[[1L]])
  where 30: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 31: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 32: FUN(X[[i]], ...)
  where 33: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 34: force(code)
  where 35: doWithOneRestart(return(expr), restart)
  where 36: withOneRestart(expr, restarts[[1L]])
  where 37: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 38: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 39: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 40: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 41: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 5. Error: 'iprotein' gives consistent results on a transect (@test-affinity.R
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis(...)
   2. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2: basis(species, logact)
  where 3: preset.basis(species[1])
  where 4 at testthat/test-affinity.R#136: basis("CHNOS")
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test-affinity.R#128: test_that("affinity() for proteins (with/without 'iprotein') returns same value as in previous package versions", 
      {
          A.2303RT.nonionized <- -3795.297
          A.2303RT.ionized <- -3075.222
          basis("CHNOS")
          ip <- pinfo("CSG_HALJP")
          expect_equal(affinity(iprotein = ip)$values[[1]][1], 
              A.2303RT.nonionized, tolerance = 1e-06)
          species("CSG_HALJP")
          expect_equal(affinity()$values[[1]][1], A.2303RT.nonionized, 
              tolerance = 1e-06)
          basis("CHNOS+")
          expect_equal(affinity(iprotein = ip)$values[[1]][1], 
              A.2303RT.ionized, tolerance = 1e-06)
          species("CSG_HALJP")
          expect_equal(affinity()$values[[1]][1], A.2303RT.ionized, 
              tolerance = 1e-06)
      })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 43: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 44: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 6. Error: affinity() for proteins (with/without 'iprotein') returns same valu
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis("CHNOS")
   2. CHNOSZ:::preset.basis(species[1])
   3. CHNOSZ::basis(species, logact)
   4. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2: basis(species, logact)
  where 3: preset.basis(species[1])
  where 4 at testthat/test-affinity.R#152: basis("CHNOS+")
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test-affinity.R#150: test_that("affinity() for proteins keeps track of pH on 2-D calculations", 
      {
          basis("CHNOS+")
          species("LYSC_CHICK")
          a1 <- affinity(pH = c(6, 8, 3))
          a2 <- affinity(pH = c(6, 8, 3), T = c(0, 75, 4))
          expect_equal(as.numeric(a1$values[[1]]), a2$values[[1]][, 
              2])
      })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 43: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 44: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 7. Error: affinity() for proteins keeps track of pH on 2-D calculations (@tes
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis("CHNOS+")
   2. CHNOSZ:::preset.basis(species[1])
   3. CHNOSZ::basis(species, logact)
   4. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2: basis(species, logact)
  where 3: preset.basis(species[1])
  where 4 at testthat/test-affinity.R#166: basis("CHNOPS+")
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test-affinity.R#159: test_that("IS can be constant or variable", {
      oldnon <- nonideal("Alberty")
      basis("CHNOPS+")
      species(c("PO4-3", "HPO4-2", "H2PO4-"))
      a0 <- affinity()
      a1 <- affinity(IS = 0.14)
      a2 <- affinity(IS = c(0, 0.14))
      expect_equal(unlist(lapply(a2$values, head, 1)), unlist(a0$values))
      expect_equal(unlist(lapply(a2$values, tail, 1)), unlist(a1$values))
      nonideal(oldnon)
  })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 43: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 44: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 8. Error: IS can be constant or variable (@test-affinity.R#166)  ------------
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis("CHNOPS+")
   2. CHNOSZ:::preset.basis(species[1])
   3. CHNOSZ::basis(species, logact)
   4. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2: basis(species, logact)
  where 3: preset.basis(species[1])
  where 4 at testthat/test-affinity.R#178: basis("CHNOS")
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test-affinity.R#176: test_that("argument recall is usable", {
      basis("CHNOS")
      species(c("CO2", "CH4"))
      a0 <- affinity(O2 = c(-80, -60))
      a1 <- affinity(O2 = c(-80, -60), T = 100)
      a2 <- affinity(a0, T = 100)
      a3 <- affinity(a1, T = 25)
      expect_identical(a1, a2)
      expect_identical(a0$values, a3$values)
  })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 43: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 44: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 9. Error: argument recall is usable (@test-affinity.R#178)  -----------------
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis("CHNOS")
   2. CHNOSZ:::preset.basis(species[1])
   3. CHNOSZ::basis(species, logact)
   4. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2: basis(species, logact)
  where 3: preset.basis(species[1])
  where 4 at testthat/test-affinity.R#191: basis("CHNOS+")
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test-affinity.R#189: test_that("sout is processed correctly", {
      basis("CHNOS+")
      species(c("H2S", "CO2", "CH4"))
      a0 <- affinity(T = c(0, 100))
      sout <- a0$sout
      species(1:2, delete = TRUE)
      a1 <- affinity(T = c(0, 100))
      a2 <- affinity(T = c(0, 100), sout = a0$sout)
      expect_equal(a1$values, a2$values)
  })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 43: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 44: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 10. Error: sout is processed correctly (@test-affinity.R#191)  --------------
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis("CHNOS+")
   2. CHNOSZ:::preset.basis(species[1])
   3. CHNOSZ::basis(species, logact)
   4. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2: basis(species, logact)
  where 3: preset.basis(species[1])
  where 4 at testthat/test-basis.R#24: basis("CHNOS+")
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test-basis.R#21: test_that("invalid basis modification requests cause an error", 
      {
          basis(delete = TRUE)
          expect_error(mod.basis("CH4", "gas"), "basis is not defined")
          b <- basis("CHNOS+")
          expect_error(mod.basis("CH4", "gas"), "is not a formula of one of the basis species")
          iCH4 <- info("CH4")
          expect_error(mod.basis(iCH4, "gas"), "is not a species index of one of the basis species")
          expect_error(mod.basis("CO2", "PPM"), "the elements .* in buffer .* are not in the basis")
          expect_error(mod.basis("CO2", "liq"), "state .* not found")
          expect_equal(basis(), b)
      })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 43: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 44: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 11. Error: invalid basis modification requests cause an error (@test-basis.R#
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis("CHNOS+")
   2. CHNOSZ:::preset.basis(species[1])
   3. CHNOSZ::basis(species, logact)
   4. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2 at testthat/test-basis.R#35: basis(c("copper", "chalcocite"))
  where 3: eval(code, test_env)
  where 4: eval(code, test_env)
  where 5: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 6: doTryCatch(return(expr), name, parentenv, handler)
  where 7: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 8: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 11: tryCatchList(expr, classes, parentenv, handlers)
  where 12: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 13: test_code(desc, code, env = parent.frame())
  where 14 at testthat/test-basis.R#34: test_that("modifying states of basis species is possible", {
      b1 <- basis(c("copper", "chalcocite"))
      b2 <- basis("Cu2S", "cr2")
      expect_equal(sum(b2$ispecies - b1$ispecies), 1)
      expect_error(basis("Cu2S", "cr4"), "state or buffer 'cr4' not found for chalcocite")
      basis("CHNOS+")
      expect_equal(basis("CO2", "gas")$state[1], "gas")
      expect_equal(basis("CO2", "aq")$state[1], "aq")
  })
  where 15: eval(code, test_env)
  where 16: eval(code, test_env)
  where 17: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 18: doTryCatch(return(expr), name, parentenv, handler)
  where 19: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 20: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 23: tryCatchList(expr, classes, parentenv, handlers)
  where 24: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 25: test_code(NULL, exprs, env)
  where 26: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 27: force(code)
  where 28: doWithOneRestart(return(expr), restart)
  where 29: withOneRestart(expr, restarts[[1L]])
  where 30: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 31: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 32: FUN(X[[i]], ...)
  where 33: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 34: force(code)
  where 35: doWithOneRestart(return(expr), restart)
  where 36: withOneRestart(expr, restarts[[1L]])
  where 37: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 38: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 39: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 40: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 41: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 12. Error: modifying states of basis species is possible (@test-basis.R#35)  
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis(c("copper", "chalcocite"))
   2. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2: basis(species, logact)
  where 3: preset.basis(species[1])
  where 4 at testthat/test-diagram.R#5: basis("CHNOS")
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test-diagram.R#3: test_that("expected errors are produced for inconsistent arguments", 
      {
          expect_error(diagram(list()), "'eout' does not look like output from equil\\(\\) or affinity\\(\\)")
          basis("CHNOS")
          species(c("glycine", "alanine"))
          a <- affinity()
          expect_message(diagram(a, plot.it = FALSE), "balance: moles of CO2 in formation reactions")
          e <- equilibrate(a)
          expect_error(diagram(e, "Z"), "Z is not a valid diagram type")
      })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 43: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 44: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 13. Error: expected errors are produced for inconsistent arguments (@test-dia
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis("CHNOS")
   2. CHNOSZ:::preset.basis(species[1])
   3. CHNOSZ::basis(species, logact)
   4. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2: basis(species, logact)
  where 3: preset.basis(species[1])
  where 4 at testthat/test-diagram.R#14: basis("CHNOS+")
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test-diagram.R#13: test_that("expected messages, errors and results arise using output from affinity()", 
      {
          basis("CHNOS+")
          basis("O2", "CO2-AC")
          species(c("formic acid", "formate", "acetic acid", "acetate"))
          a <- affinity()
          expect_error(diagram(a, "loga.equil"), "'eout' is not the output from equil\\(\\)")
          expect_error(diagram(a, "O2"), "is not numeric - was a buffer selected\\?")
          expect_message(diagram(a, plot.it = FALSE), "balance: moles of CO2 in formation reactions")
          d.1 <- diagram(a, balance = 1, plot.it = FALSE)
          d.CO2 <- diagram(a, plot.it = FALSE)
          expect_equal(as.numeric(d.CO2$plotvals), as.numeric(d.1$plotvals)/c(1, 
              1, 2, 2))
          basis("O2", -90)
          a <- affinity(O2 = c(-80, -70))
          expect_error(diagram(a, "CO2", groups = list(1:2, 3:4)), 
              "can't plot equilibrium activities of basis species for grouped species")
          expect_error(diagram(a, "CO2", alpha = TRUE), "equilibrium activities of basis species not available with alpha=TRUE")
          d <- diagram(a, "CO2", plot.it = FALSE)
          a <- affinity(O2 = d$vals[[1]], CO2 = d$plotvals[[4]])
          expect_equal(a$values[[4]], array(numeric(128)))
      })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 43: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 44: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 14. Error: expected messages, errors and results arise using output from affi
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis("CHNOS+")
   2. CHNOSZ:::preset.basis(species[1])
   3. CHNOSZ::basis(species, logact)
   4. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2: basis(species, logact)
  where 3: preset.basis(species[1])
  where 4 at testthat/test-diagram.R#44: basis("CHNOS+")
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test-diagram.R#43: test_that("'groups' and 'alpha' work as expected", {
      basis("CHNOS+")
      species(c("formic acid", "formate", "acetic acid", "acetate"))
      a <- affinity(O2 = c(-80, -60))
      e <- equilibrate(a)
      d <- diagram(e, groups = list(1:2, 3:4), plot.it = FALSE)
      n.balance <- balance(a)$n.balance
      expect_equal(d$plotvals[[1]], log10(n.balance[1] * 10^e$loga.equil[[1]] + 
          n.balance[2] * 10^e$loga.equil[[2]]))
      expect_equal(d$plotvals[[2]], log10(n.balance[3] * 10^e$loga.equil[[3]] + 
          n.balance[4] * 10^e$loga.equil[[4]]))
      d <- diagram(e, alpha = TRUE, plot.it = FALSE)
      expect_equal(Reduce("+", d$plotvals), array(rep(1, 128)), 
          check.attributes = FALSE)
  })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 43: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 44: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 15. Error: 'groups' and 'alpha' work as expected (@test-diagram.R#44)  ------
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis("CHNOS+")
   2. CHNOSZ:::preset.basis(species[1])
   3. CHNOSZ::basis(species, logact)
   4. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2: basis(species, logact)
  where 3: preset.basis(species[1])
  where 4 at testthat/test-diagram.R#62: basis("CHNOS")
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test-diagram.R#61: test_that("'normalize' and 'as.residue' work as expected", {
      basis("CHNOS")
      species(c("LYSC_CHICK", "MYG_PHYCA", "RNAS1_BOVIN", "CYC_BOVIN"))
      a <- affinity(O2 = c(-80, -70))
      expect_error(diagram(a, normalize = TRUE), "can be TRUE only for a 2-D \\(predominance\\) diagram")
      a <- affinity(H2O = c(-10, 0), O2 = c(-80, -70))
      d1 <- diagram(a, normalize = TRUE, plot.it = FALSE)
      e <- equilibrate(a, normalize = TRUE)
      d2 <- diagram(e, plot.it = FALSE)
      expect_equal(d1$predominant, d2$predominant)
      expect_error(diagram(e, normalize = TRUE), "can be TRUE only if 'eout' is the output from affinity\\(\\)")
      d3 <- diagram(a, as.residue = TRUE, plot.it = FALSE)
      e <- equilibrate(a, as.residue = TRUE)
      d4 <- diagram(e, plot.it = FALSE)
      expect_equal(d3$predominant, d4$predominant)
  })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 43: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 44: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 16. Error: 'normalize' and 'as.residue' work as expected (@test-diagram.R#62)
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis("CHNOS")
   2. CHNOSZ:::preset.basis(species[1])
   3. CHNOSZ::basis(species, logact)
   4. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2: basis(species, logact)
  where 3: preset.basis(species[1])
  where 4 at testthat/test-diagram.R#81: basis("CHNOS")
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test-diagram.R#80: test_that("diagram() handles 2D plots with different x and y resolution and warns for >1 species in contour plot", 
      {
          basis("CHNOS")
          species(c("alanine", "glycine", "serine", "methionine"))
          a <- affinity(T = c(0, 200, 6), O2 = c(-90, -60, 5))
      })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 43: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 44: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 17. Error: diagram() handles 2D plots with different x and y resolution and w
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis("CHNOS")
   2. CHNOSZ:::preset.basis(species[1])
   3. CHNOSZ::basis(species, logact)
   4. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2 at testthat/test-diagram.R#90: basis(c("H2", "O2", "CO2"), c(-7.19, -60, -2.65))
  where 3: eval(code, test_env)
  where 4: eval(code, test_env)
  where 5: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 6: doTryCatch(return(expr), name, parentenv, handler)
  where 7: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 8: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 11: tryCatchList(expr, classes, parentenv, handlers)
  where 12: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 13: test_code(desc, code, env = parent.frame())
  where 14 at testthat/test-diagram.R#88: test_that("NaN values from equilibrate() are preserved (as NA in predominance calculation)", 
      {
          basis(c("H2", "O2", "CO2"), c(-7.19, -60, -2.65))
          species(c("n-hexadecanol", "n-hexadecanoic acid", "n-octadecanol", 
              "n-octadecanoic acid"), c("liq", "liq", "liq", "liq"))
          a <- affinity(H2 = c(-12, 0), O2 = c(-90, -50), T = 30)
          e <- equilibrate(a, balance = 1)
          d <- diagram(e, plot.it = FALSE)
          expect_equal(d$predominant[1, 128], as.numeric(NA))
          expect_equal(d$predominant[128, 1], as.numeric(NA))
      })
  where 15: eval(code, test_env)
  where 16: eval(code, test_env)
  where 17: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 18: doTryCatch(return(expr), name, parentenv, handler)
  where 19: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 20: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 23: tryCatchList(expr, classes, parentenv, handlers)
  where 24: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 25: test_code(NULL, exprs, env)
  where 26: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 27: force(code)
  where 28: doWithOneRestart(return(expr), restart)
  where 29: withOneRestart(expr, restarts[[1L]])
  where 30: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 31: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 32: FUN(X[[i]], ...)
  where 33: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 34: force(code)
  where 35: doWithOneRestart(return(expr), restart)
  where 36: withOneRestart(expr, restarts[[1L]])
  where 37: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 38: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 39: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 40: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 41: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 18. Error: NaN values from equilibrate() are preserved (as NA in predominance
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis(c("H2", "O2", "CO2"), c(-7.19, -60, -2.65))
   2. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2: basis(species, logact)
  where 3: preset.basis(species[1])
  where 4 at testthat/test-equilibrate.R#5: basis("CHNOS+")
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 15: test_code(NULL, exprs, env)
  where 16: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 17: force(code)
  where 18: doWithOneRestart(return(expr), restart)
  where 19: withOneRestart(expr, restarts[[1L]])
  where 20: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 21: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 22: FUN(X[[i]], ...)
  where 23: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 24: force(code)
  where 25: doWithOneRestart(return(expr), restart)
  where 26: withOneRestart(expr, restarts[[1L]])
  where 27: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 28: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 29: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 30: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 31: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 32: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 19. Error: (unknown) (@test-equilibrate.R#5)  -------------------------------
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis("CHNOS+")
   2. CHNOSZ:::preset.basis(species[1])
   3. CHNOSZ::basis(species, logact)
   4. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2: basis(species, logact)
  where 3: preset.basis(species[1])
  where 4 at testthat/test-logmolality.R#62: basis("CHNOS+")
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test-logmolality.R#3: test_that("non-zero ionic strength transforms variables from activity to molality", 
      {
          wprop <- water(c("A_DH", "B_DH"), P = 1)
          speciesprops <- subcrt(c("H+", "HCO3-", "CO2"), T = 25)$out
          nonid <- nonideal(c("H+", "HCO3-", "CO2"), speciesprops, 
              IS = 1, T = 298.15, P = 1, A_DH = wprop$A_DH, B_DH = wprop$B_DH)
          expect_maxdiff(nonid[[2]]$loggam, -0.1868168, 1e-07)
          out1 <- subcrt(c("H+", "HCO3-", "CO2"), T = 25, IS = 1)$out
          loggam_HCO3 <- out1[[2]]$loggam
          loggam_CO2 <- out1[[3]]$loggam
          expect_equal(nonid[[2]]$loggam, loggam_HCO3)
          expect_equal(nonid[[3]]$loggam, loggam_CO2)
          out0 <- subcrt(c("H+", "HCO3-", "CO2"), T = 25)$out
          expect_equal(out1[[2]]$G - out0[[2]]$G, -convert(loggam_HCO3, 
              "G"))
          expect_equal(out1[[3]]$G - out0[[3]]$G, -convert(loggam_CO2, 
              "G"))
          logK <- subcrt(c("CO2", "H2O", "H+", "HCO3-"), c(-1, 
              -1, 1, 1), T = 25)$out$logK
          expect_maxdiff(logK, -6.344694, 1e-06)
          logQ0 <- (-7 + -3) - (0 + -3)
          A0manual <- -convert(logK - logQ0, "G")
          A0subcrt <- subcrt(c("CO2", "H2O", "H+", "HCO3-"), c(-1, 
              -1, 1, 1), T = 25, logact = c(-3, 0, -7, -3))$out$A
          expect_equal(A0subcrt, A0manual)
          logaHCO3 <- -3 + loggam_HCO3
          logaCO2 <- -3 + loggam_CO2
          logQ1 <- (-7 + logaHCO3) - (0 + logaCO2)
          A1manual <- -convert(logK - logQ1, "G")
          A1subcrt <- subcrt(c("CO2", "H2O", "H+", "HCO3-"), c(-1, 
              -1, 1, 1), T = 25, logact = c(-3, 0, -7, -3), IS = 1)$out$A
          expect_equal(A1subcrt, A1manual)
          basis("CHNOS+")
          species(c("CO2", "HCO3-"))
          a0 <- affinity()
          A0affinity <- -convert(a0$values[[2]], "G")
          expect_equal(A0affinity[[1]], A0subcrt)
          a1 <- affinity(IS = 1)
          A1affinity <- -convert(a1$values[[2]], "G")
          expect_equal(A1affinity[[1]], A1subcrt)
          swap.basis("CO2", "HCO3-")
          basis("HCO3-", -3)
          a0 <- affinity()
          a1 <- affinity(IS = 1)
          expect_equal(a0$values[[2]][1], 0)
          expect_equal(a1$values[[2]][1], 0)
          ACO2_0affinity <- -convert(a0$values[[1]], "G")
          ACO2_1affinity <- -convert(a1$values[[1]], "G")
          logKrev <- -logK
          logQrev0 <- -logQ0
          logQrev1 <- -logQ1
          ACO2_0manual <- -convert(logKrev - logQrev0, "G")
          ACO2_1manual <- -convert(logKrev - logQrev1, "G")
          expect_equal(ACO2_0manual, ACO2_0affinity[[1]])
          expect_equal(ACO2_1manual, ACO2_1affinity[[1]])
          e0 <- equilibrate(a0)
          e1 <- equilibrate(a1)
          logact_HCO3 <- e0$loga.equil[[2]]
          logact_CO2 <- e0$loga.equil[[1]]
          logQeq0 <- (-7 + logact_HCO3) - (logact_CO2 + 0)
          Aeq0 <- -convert(logK - logQeq0, "G")
          expect_equal(Aeq0[[1]], 0)
          logact_HCO3 <- e1$loga.equil[[2]]
          logact_CO2 <- e1$loga.equil[[1]]
          logQeq1 <- (-7 + logact_HCO3 + loggam_HCO3) - (logact_CO2 + 
              loggam_CO2 + 0)
          Aeq1 <- -convert(logK - logQeq1, "G")
          expect_equal(Aeq1[[1]], 0)
          a.balance <- 10^e1$loga.balance
          m.total <- sum(10^unlist(e1$loga.equil))
          expect_equal(a.balance, m.total)
      })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 43: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 44: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 20. Error: non-zero ionic strength transforms variables from activity to mola
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis("CHNOS+")
   2. CHNOSZ:::preset.basis(species[1])
   3. CHNOSZ::basis(species, logact)
   4. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2: basis(species, logact)
  where 3: preset.basis(species[1])
  where 4 at testthat/test-makeup.R#50: basis("CHNOS")
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test-makeup.R#45: test_that("makeup has a fall-through mechanism for matrices and named objects", 
      {
          expect_equal(makeup(makeup("CH4")), makeup("CH4"))
          expect_equal(makeup(list(makeup("CH4"))), list(makeup("CH4")))
          basis("CHNOS")
          expect_equal(species.basis("CH4")[1, ], species.basis(info("CH4"))[1, 
              ])
          expect_equal(species.basis(makeup("CH4"))[1, ], species.basis("CH4")[1, 
              ])
          protein <- c("LYSC_CHICK", "RNAS1_BOVIN", "CYC_BOVIN", 
              "MYG_PHYCA", "MYG_HORSE")
          pf <- protein.formula(protein)
          basis(protein)
          bmat <- basis.elements()
          expect_equal(makeup(pf)[[1]], makeup(as.chemical.formula(pf)[1]))
          expect_equal(makeup(pf), makeup(bmat))
      })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 43: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 44: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 21. Error: makeup has a fall-through mechanism for matrices and named objects
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis("CHNOS")
   2. CHNOSZ:::preset.basis(species[1])
   3. CHNOSZ::basis(species, logact)
   4. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2 at testthat/test-mosaic.R#4: basis(c("CO2", "H2O", "NH3", "O2"), c(0, 0, 0, 0))
  where 3: eval(code, test_env)
  where 4: eval(code, test_env)
  where 5: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 6: doTryCatch(return(expr), name, parentenv, handler)
  where 7: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 8: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 11: tryCatchList(expr, classes, parentenv, handlers)
  where 12: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 13: test_code(desc, code, env = parent.frame())
  where 14 at testthat/test-mosaic.R#3: test_that("results are consistent with affinity()", {
      basis(c("CO2", "H2O", "NH3", "O2"), c(0, 0, 0, 0))
      species(c("alanine", "glycine"))
      a25 <- affinity()
      m1_25 <- mosaic("NH3", "CO2")
      expect_equal(a25$values, m1_25$A.species$values)
      m2_25 <- mosaic("NH3", "CO2", blend = FALSE)
      expect_equal(a25$values, m2_25$A.species$values)
      a500 <- affinity(T = 500)
      m1_500 <- mosaic("NH3", "CO2", T = 500)
      expect_equal(a500$values, m1_500$A.species$values)
      m2_500 <- mosaic("NH3", "CO2", blend = FALSE, T = 500)
      expect_equal(a500$values, m2_500$A.species$values)
  })
  where 15: eval(code, test_env)
  where 16: eval(code, test_env)
  where 17: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 18: doTryCatch(return(expr), name, parentenv, handler)
  where 19: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 20: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 23: tryCatchList(expr, classes, parentenv, handlers)
  where 24: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 25: test_code(NULL, exprs, env)
  where 26: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 27: force(code)
  where 28: doWithOneRestart(return(expr), restart)
  where 29: withOneRestart(expr, restarts[[1L]])
  where 30: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 31: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 32: FUN(X[[i]], ...)
  where 33: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 34: force(code)
  where 35: doWithOneRestart(return(expr), restart)
  where 36: withOneRestart(expr, restarts[[1L]])
  where 37: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 38: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 39: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 40: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 41: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 22. Error: results are consistent with affinity() (@test-mosaic.R#4)  -------
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis(c("CO2", "H2O", "NH3", "O2"), c(0, 0, 0, 0))
   2. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2 at testthat/test-mosaic.R#29: basis(c("FeO", "SO4-2", "H2O", "H+", "e-"))
  where 3: eval(code, test_env)
  where 4: eval(code, test_env)
  where 5: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 6: doTryCatch(return(expr), name, parentenv, handler)
  where 7: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 8: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 11: tryCatchList(expr, classes, parentenv, handlers)
  where 12: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 13: test_code(desc, code, env = parent.frame())
  where 14 at testthat/test-mosaic.R#24: test_that("blend=TRUE produces reasonable values", {
      basis(c("FeO", "SO4-2", "H2O", "H+", "e-"))
      basis("SO4-2", -6)
      basis("Eh", -0.15)
      species(c("hematite", "magnetite"))
      bases <- c("SO4-2", "HSO4-", "HS-", "H2S")
      pH <- c(0, 14, 29)
      m1 <- mosaic(bases, pH = pH, blend = FALSE)
      m2 <- mosaic(bases, pH = pH)
      expect_equivalent(m2$A.species$values[[1]], m1$A.species$values[[1]])
      species(c("pyrrhotite", "pyrite"))
      m3 <- mosaic(bases, pH = pH, blend = FALSE)
      m4 <- mosaic(bases, pH = pH)
      expect_equal(sapply(m3$A.species$values, "[", 13), sapply(m4$A.species$values, 
          "[", 13), tol = 0.1)
      expect_equal(sapply(m3$A.species$values, "[", 1), sapply(m4$A.species$values, 
          "[", 1), tol = 1e-07)
      expect_equal(sapply(m3$A.species$values, "[", 29), sapply(m4$A.species$values, 
          "[", 29), tol = 1e-13)
  })
  where 15: eval(code, test_env)
  where 16: eval(code, test_env)
  where 17: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 18: doTryCatch(return(expr), name, parentenv, handler)
  where 19: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 20: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 23: tryCatchList(expr, classes, parentenv, handlers)
  where 24: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 25: test_code(NULL, exprs, env)
  where 26: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 27: force(code)
  where 28: doWithOneRestart(return(expr), restart)
  where 29: withOneRestart(expr, restarts[[1L]])
  where 30: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 31: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 32: FUN(X[[i]], ...)
  where 33: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 34: force(code)
  where 35: doWithOneRestart(return(expr), restart)
  where 36: withOneRestart(expr, restarts[[1L]])
  where 37: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 38: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 39: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 40: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 41: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 23. Error: blend=TRUE produces reasonable values (@test-mosaic.R#29)  -------
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis(c("FeO", "SO4-2", "H2O", "H+", "e-"))
   2. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2 at testthat/test-mosaic.R#55: basis(c("CO2", "NH3", "O2", "H2O", "H+"))
  where 3: eval(code, test_env)
  where 4: eval(code, test_env)
  where 5: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 6: doTryCatch(return(expr), name, parentenv, handler)
  where 7: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 8: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 11: tryCatchList(expr, classes, parentenv, handlers)
  where 12: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 13: test_code(desc, code, env = parent.frame())
  where 14 at testthat/test-mosaic.R#53: test_that("mosaic() - equilibrate() produces equilibrium activities", 
      {
          basis(c("CO2", "NH3", "O2", "H2O", "H+"))
          species(c("acetamide", "acetic acid", "acetate"))
          m <- mosaic(c("NH3", "NH4+"), pH = c(0, 14))
          e <- equilibrate(m$A.species)
          s1 <- subcrt(c("acetic acid", "NH4+", "acetamide", "water", 
              "H+"), c(-1, -1, 1, 1, 1), T = 25)
          logK1 <- s1$out$logK
          loga_acetic <- e$loga.equil[[2]]
          loga_NH4 <- m$E.bases[[1]]$loga.equil[[2]]
          loga_acetamide <- e$loga.equil[[1]]
          loga_H2O <- m$E.bases[[1]]$basis$logact[[4]]
          loga_Hplus <- -m$E.bases[[1]]$vals$pH
          logQ1 <- -loga_acetic - loga_NH4 + loga_acetamide + loga_H2O + 
              loga_Hplus
          A1 <- logQ1 - logK1
          expect_equivalent(A1, rep(0, length(A1)))
      })
  where 15: eval(code, test_env)
  where 16: eval(code, test_env)
  where 17: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 18: doTryCatch(return(expr), name, parentenv, handler)
  where 19: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 20: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 23: tryCatchList(expr, classes, parentenv, handlers)
  where 24: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 25: test_code(NULL, exprs, env)
  where 26: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 27: force(code)
  where 28: doWithOneRestart(return(expr), restart)
  where 29: withOneRestart(expr, restarts[[1L]])
  where 30: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 31: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 32: FUN(X[[i]], ...)
  where 33: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 34: force(code)
  where 35: doWithOneRestart(return(expr), restart)
  where 36: withOneRestart(expr, restarts[[1L]])
  where 37: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 38: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 39: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 40: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 41: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 24. Error: mosaic() - equilibrate() produces equilibrium activities (@test-mo
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis(c("CO2", "NH3", "O2", "H2O", "H+"))
   2. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2 at testthat/test-mosaic.R#83: basis(c("Au", "Cl-", "H2S", "H2O", "oxygen", "H+"))
  where 3: eval(code, test_env)
  where 4: eval(code, test_env)
  where 5: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 6: doTryCatch(return(expr), name, parentenv, handler)
  where 7: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 8: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 11: tryCatchList(expr, classes, parentenv, handlers)
  where 12: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 13: test_code(desc, code, env = parent.frame())
  where 14 at testthat/test-mosaic.R#77: test_that("mosaic() - solubility() produces equilibrium activities", 
      {
          T <- 250
          P <- 500
          basis(c("Au", "Cl-", "H2S", "H2O", "oxygen", "H+"))
          species(c("Au(HS)2-", "AuHS", "AuOH", "AuCl2-"))
          basis("H2S", -2)
          basis("O2", -40)
          NaCl <- NaCl(T = T, P = P, m_tot = 1)
          basis("Cl-", log10(NaCl$m_Cl))
          bases <- c("H2S", "HS-", "HSO4-", "SO4-2")
          m <- mosaic(bases, pH = c(2, 10), T = 250, P = 500, IS = NaCl$IS)
          s <- solubility(m$A.species)
          s1 <- subcrt(c("Au", "H2S", "oxygen", "Au(HS)2-", "H2O", 
              "H+"), c(-1, -2, -0.25, 1, 0.5, 1), T = T, P = P, 
              IS = NaCl$IS)
          logK1 <- s1$out$logK
          loga_Au <- m$A.bases$basis$logact[[1]]
          loga_H2S <- m$E.bases[[1]]$loga.equil[[1]]
          logf_O2 <- m$A.bases$basis$logact[[5]]
          loga_AuHS2minus <- s$loga.equil[[1]]
          loga_H2O <- m$A.bases$basis$logact[[4]]
          loga_Hplus <- -m$A.bases$vals$pH
          logQ1 <- -1 * loga_Au - 2 * loga_H2S - 0.25 * logf_O2 + 
              1 * loga_AuHS2minus + 0.5 * loga_H2O + 1 * loga_Hplus
          A1 <- logQ1 - logK1
          expect_equivalent(A1, rep(0, length(A1)))
      })
  where 15: eval(code, test_env)
  where 16: eval(code, test_env)
  where 17: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 18: doTryCatch(return(expr), name, parentenv, handler)
  where 19: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 20: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 23: tryCatchList(expr, classes, parentenv, handlers)
  where 24: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 25: test_code(NULL, exprs, env)
  where 26: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 27: force(code)
  where 28: doWithOneRestart(return(expr), restart)
  where 29: withOneRestart(expr, restarts[[1L]])
  where 30: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 31: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 32: FUN(X[[i]], ...)
  where 33: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 34: force(code)
  where 35: doWithOneRestart(return(expr), restart)
  where 36: withOneRestart(expr, restarts[[1L]])
  where 37: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 38: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 39: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 40: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 41: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 25. Error: mosaic() - solubility() produces equilibrium activities (@test-mos
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis(c("Au", "Cl-", "H2S", "H2O", "oxygen", "H+"))
   2. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2 at testthat/test-mosaic.R#122: basis(c("FeO", "SO4-2", "H2O", "H+", "e-", "CO3-2"))
  where 3: eval(code, test_env)
  where 4: eval(code, test_env)
  where 5: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 6: doTryCatch(return(expr), name, parentenv, handler)
  where 7: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 8: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 11: tryCatchList(expr, classes, parentenv, handlers)
  where 12: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 13: test_code(desc, code, env = parent.frame())
  where 14 at testthat/test-mosaic.R#116: test_that("mosaic() - equilibrate() produces equilibrium activities that are consistent with\n          stability differences of minerals and multiple groups of changing basis species", 
      {
          basis(c("FeO", "SO4-2", "H2O", "H+", "e-", "CO3-2"))
          basis("SO4-2", -6)
          basis("CO3-2", 0)
          basis("pH", 6.3)
          species(c("pyrrhotite", "pyrite", "hematite", "magnetite", 
              "siderite"))
          bases <- list(c("SO4-2", "HSO4-", "HS-", "H2S"), c("CO3-2", 
              "HCO3-", "CO2"))
          m <- mosaic(bases, Eh = c(-0.5, 0))
          s1 <- subcrt(c("pyrite", "CO2", "H2O", "H+", "e-", "siderite", 
              "H2S"), c(-1, -1, -1, -2, -2, 1, 2), T = 25)
          logK <- s1$out$logK
          loga_pyrite <- loga_siderite <- loga_H2O <- 0
          loga_Hplus <- m$A.bases[[1]]$basis$logact[[4]]
          loga_eminus <- -convert(m$A.bases[[1]]$vals$Eh, "pe")
          loga_H2S <- m$E.bases[[1]]$loga.equil[[4]]
          loga_CO2 <- m$E.bases[[2]]$loga.equil[[3]]
          logQ <- -1 * loga_pyrite - 1 * loga_CO2 - 1 * loga_H2O - 
              2 * loga_Hplus - 2 * loga_eminus + 1 * loga_siderite + 
              2 * loga_H2S
          A <- logQ - logK
          Adiff <- A - (m$A.species$values[[2]] - m$A.species$values[[5]])
          expect_equivalent(Adiff, rep(0, length(Adiff)))
      })
  where 15: eval(code, test_env)
  where 16: eval(code, test_env)
  where 17: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 18: doTryCatch(return(expr), name, parentenv, handler)
  where 19: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 20: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 23: tryCatchList(expr, classes, parentenv, handlers)
  where 24: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 25: test_code(NULL, exprs, env)
  where 26: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 27: force(code)
  where 28: doWithOneRestart(return(expr), restart)
  where 29: withOneRestart(expr, restarts[[1L]])
  where 30: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 31: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 32: FUN(X[[i]], ...)
  where 33: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 34: force(code)
  where 35: doWithOneRestart(return(expr), restart)
  where 36: withOneRestart(expr, restarts[[1L]])
  where 37: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 38: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 39: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 40: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 41: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 26. Error: mosaic() - equilibrate() produces equilibrium activities that are 
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis(c("FeO", "SO4-2", "H2O", "H+", "e-", "CO3-2"))
   2. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2: basis(species, logact)
  where 3: preset.basis(species[1])
  where 4 at testthat/test-nonideal.R#54: basis("CHNOS+")
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test-nonideal.R#53: test_that("affinity transect incorporates IS correctly", {
      basis("CHNOS+")
      species("acetate")
      basis("O2", -80)
      a80_0 <- affinity()
      basis("O2", -60)
      a60_1 <- affinity(IS = 1)
      a <- affinity(O2 = seq(-80, -60, length.out = 4), IS = seq(0, 
          1, length.out = 4))
      expect_equal(a$values[[1]][1], a80_0$values[[1]][1])
      expect_equal(a$values[[1]][4], a60_1$values[[1]][1])
      a25_0 <- affinity()
      a50_1 <- affinity(T = 50, IS = 1)
      a <- affinity(T = seq(25, 50, length.out = 4), IS = seq(0, 
          1, length.out = 4))
      expect_equal(a$values[[1]][1], a25_0$values[[1]][1])
      expect_equal(a$values[[1]][4], a50_1$values[[1]][1])
  })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 43: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 44: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 27. Error: affinity transect incorporates IS correctly (@test-nonideal.R#54) 
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis("CHNOS+")
   2. CHNOSZ:::preset.basis(species[1])
   3. CHNOSZ::basis(species, logact)
   4. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2: basis(species, logact)
  where 3: preset.basis(species[1])
  where 4 at testthat/test-protein.info.R#19: basis("CHNOS+")
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test-protein.info.R#16: test_that("protein.equil() reports values consistent with Dick and Shock (2011)", 
      {
          protein <- pinfo(c("CSG_METVO", "CSG_METJA"))
          suppressMessages(add.obigt("OldAA"))
          basis("CHNOS+")
          suppressMessages(swap.basis("O2", "H2"))
          pequil <- protein.equil(protein, loga.protein = -3)
          expect_true(any(grepl(c("0\\.435.*1\\.36"), pequil)))
          expect_true(any(grepl(c("-3\\.256.*-2\\.834"), pequil)))
      })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 43: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 44: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 28. Error: protein.equil() reports values consistent with Dick and Shock (201
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis("CHNOS+")
   2. CHNOSZ:::preset.basis(species[1])
   3. CHNOSZ::basis(species, logact)
   4. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2: basis(species, logact)
  where 3: preset.basis(species[1])
  where 4 at testthat/test-revisit.R#7: basis("CHNOS")
  where 5: withCallingHandlers(expr, message = function(c) invokeRestart("muffleMessage"))
  where 6 at testthat/test-revisit.R#4: suppressMessages({
      add.obigt("OldAA")
      basis("CHNOS")
      basis("O2", -65)
      species(c("leucine", "glycine", "glutamic acid"))
      a <- affinity()
      e0 <- equilibrate(a)
      a <- affinity(O2 = c(-75, -65))
      e1 <- equilibrate(a)
      a <- affinity(O2 = c(-75, -65), NH3 = c(-4, 100, 3))
      e2 <- equilibrate(a)
      a <- affinity(O2 = c(-75, -65, 4), H2O = c(-8, 0, 3), NH3 = c(-6, 
          -4, 2))
      e3 <- equilibrate(a)
  })
  where 7: eval(code, test_env)
  where 8: eval(code, test_env)
  where 9: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 10: doTryCatch(return(expr), name, parentenv, handler)
  where 11: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 12: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 13: doTryCatch(return(expr), name, parentenv, handler)
  where 14: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 15: tryCatchList(expr, classes, parentenv, handlers)
  where 16: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 17: test_code(NULL, exprs, env)
  where 18: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 19: force(code)
  where 20: doWithOneRestart(return(expr), restart)
  where 21: withOneRestart(expr, restarts[[1L]])
  where 22: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 23: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 24: FUN(X[[i]], ...)
  where 25: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 26: force(code)
  where 27: doWithOneRestart(return(expr), restart)
  where 28: withOneRestart(expr, restarts[[1L]])
  where 29: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 30: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 31: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 32: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 33: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 34: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 29. Error: (unknown) (@test-revisit.R#4)  -----------------------------------
  the condition has length > 1
  Backtrace:
   1. base::suppressMessages(...)
   3. CHNOSZ::basis("CHNOS")
   4. CHNOSZ:::preset.basis(species[1])
   5. CHNOSZ::basis(species, logact)
   6. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2 at testthat/test-solubility.R#11: basis(c("carbon dioxide", "H2O", "O2", "H+"))
  where 3: eval(code, test_env)
  where 4: eval(code, test_env)
  where 5: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 6: doTryCatch(return(expr), name, parentenv, handler)
  where 7: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 8: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 11: tryCatchList(expr, classes, parentenv, handlers)
  where 12: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 13: test_code(desc, code, env = parent.frame())
  where 14 at testthat/test-solubility.R#3: test_that("solubility() produces stable conditions (affinity = 0)", 
      {
          pH <- c(0, 14)
          res <- 100
          T <- 25
          IS <- 0
          basis(c("carbon dioxide", "H2O", "O2", "H+"))
          basis("CO2", -3.5)
          species(c("CO2", "HCO3-", "CO3-2"))
          a <- affinity(pH = c(pH, res), T = T, IS = IS)
          s <- solubility(a)
          checkfun <- function(i) {
              logact <- sapply(s$loga.equil, "[", i)
              species(1:3, logact)
              basis("pH", s$vals[[1]][i])
              affinity(T = T, IS = IS)
          }
          expect_equal(max(abs(unlist(checkfun(33)$values))), 0)
          expect_equal(max(abs(unlist(checkfun(99)$values))), 0)
          basis(c("calcite", "Ca+2", "H2O", "O2", "H+"))
          species(c("CO2", "HCO3-", "CO3-2"))
          a <- affinity(pH = c(pH, res), T = T, IS = IS)
          s <- solubility(a)
          checkfun <- function(i) {
              logact <- sapply(s$loga.equil, "[", i)
              species(1:3, logact)
              basis("pH", s$vals[[1]][i])
              basis("Ca+2", s$loga.balance[i])
              affinity(T = T, IS = IS)
          }
          expect_equal(max(abs(unlist(checkfun(33)$values))), 0)
          expect_equal(max(abs(unlist(checkfun(99)$values))), 0)
      })
  where 15: eval(code, test_env)
  where 16: eval(code, test_env)
  where 17: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 18: doTryCatch(return(expr), name, parentenv, handler)
  where 19: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 20: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 23: tryCatchList(expr, classes, parentenv, handlers)
  where 24: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 25: test_code(NULL, exprs, env)
  where 26: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 27: force(code)
  where 28: doWithOneRestart(return(expr), restart)
  where 29: withOneRestart(expr, restarts[[1L]])
  where 30: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 31: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 32: FUN(X[[i]], ...)
  where 33: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 34: force(code)
  where 35: doWithOneRestart(return(expr), restart)
  where 36: withOneRestart(expr, restarts[[1L]])
  where 37: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 38: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 39: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 40: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 41: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 30. Error: solubility() produces stable conditions (affinity = 0) (@test-solu
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis(c("carbon dioxide", "H2O", "O2", "H+"))
   2. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2 at testthat/test-solubility.R#48: basis(c("calcite", "H2O", "Ca+2", "O2", "H+"))
  where 3: eval(code, test_env)
  where 4: eval(code, test_env)
  where 5: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 6: doTryCatch(return(expr), name, parentenv, handler)
  where 7: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 8: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 11: tryCatchList(expr, classes, parentenv, handlers)
  where 12: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 13: test_code(desc, code, env = parent.frame())
  where 14 at testthat/test-solubility.R#46: test_that("solubility() catches some error conditions", {
      basis(c("calcite", "H2O", "Ca+2", "O2", "H+"))
      species(c("CO2", "HCO3-", "CO3-2"))
      a <- affinity()
      expect_message(solubility(a), "test for dissociation reaction returns FALSE")
  })
  where 15: eval(code, test_env)
  where 16: eval(code, test_env)
  where 17: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 18: doTryCatch(return(expr), name, parentenv, handler)
  where 19: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 20: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 23: tryCatchList(expr, classes, parentenv, handlers)
  where 24: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 25: test_code(NULL, exprs, env)
  where 26: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 27: force(code)
  where 28: doWithOneRestart(return(expr), restart)
  where 29: withOneRestart(expr, restarts[[1L]])
  where 30: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 31: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 32: FUN(X[[i]], ...)
  where 33: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 34: force(code)
  where 35: doWithOneRestart(return(expr), restart)
  where 36: withOneRestart(expr, restarts[[1L]])
  where 37: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 38: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 39: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 40: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 41: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 31. Error: solubility() catches some error conditions (@test-solubility.R#48)
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis(c("calcite", "H2O", "Ca+2", "O2", "H+"))
   2. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2: basis(species, logact)
  where 3: preset.basis(species[1])
  where 4 at testthat/test-species.R#9: basis("CHNOS")
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test-species.R#6: test_that("species not contained by basis cause errors", {
      expect_error(species("H2O"), "basis species are not defined")
      expect_error(species.basis("H2O"), "basis species are not defined")
      basis("CHNOS")
      expect_error(species.basis("U"), "element\\(s\\) not in the basis\\: U")
      expect_error(species("fayalite"), "element\\(s\\) not in the basis\\: Fe Si")
  })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 43: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 44: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 32. Error: species not contained by basis cause errors (@test-species.R#9)  -
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis("CHNOS")
   2. CHNOSZ:::preset.basis(species[1])
   3. CHNOSZ::basis(species, logact)
   4. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2: basis(species, logact)
  where 3: preset.basis(species[1])
  where 4 at testthat/test-species.R#15: basis("CHNOS")
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test-species.R#14: test_that("for one or more species, species.basis() keeps track of zeroes and puts elements in order of thermo$basis", 
      {
          basis("CHNOS")
          test0 <- count.elements("OHN0")
          test1 <- count.elements("HN0O")
          expect_equal(species.basis(test0), species.basis(test1))
          expect_equal(unique(as.numeric(species.basis(makeup(c("C", 
              "CCN"))))), 0)
          expect_equal(species.basis(makeup(c("C", "CCN"), count.zero = TRUE))[2, 
              , drop = FALSE], species.basis(makeup("CCN")))
      })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 43: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 44: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 33. Error: for one or more species, species.basis() keeps track of zeroes and
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis("CHNOS")
   2. CHNOSZ:::preset.basis(species[1])
   3. CHNOSZ::basis(species, logact)
   4. CHNOSZ:::put.basis(ispecies, logact)
  
  -- 34. Error: deleting nonexistent species causes error or warning (@test-specie
  basis species are not defined
  Backtrace:
   1. CHNOSZ::species("H2O")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2: basis(species, logact)
  where 3: preset.basis(species[1])
  where 4 at testthat/test-species.R#35: basis("CHNOS")
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test-species.R#34: test_that("non-available species cause error, and species can be added or modified", 
      {
          basis("CHNOS")
          expect_error(species("wate"), "species not available")
          sdef <- species("CO2")
          expect_equal(nrow(species("CO2")), 1)
          expect_equal(species(1, "gas")$state, "gas")
          expect_equal(species(1, -5)$logact, -5)
          expect_equal(nrow(species("CO2")), 2)
          expect_equal(nrow(species(info("alanine"))), 3)
          expect_equal(species(3)$name, "alanine")
          expect_equal(nrow(species("alanine", "cr")), 4)
          expect_equal(species("alanine", -7)$logact[3], -7)
      })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 43: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 44: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 35. Error: non-available species cause error, and species can be added or mod
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis("CHNOS")
   2. CHNOSZ:::preset.basis(species[1])
   3. CHNOSZ::basis(species, logact)
   4. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2: basis(species, logact)
  where 3: preset.basis(species[1])
  where 4 at testthat/test-species.R#58: basis("CHNOS")
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test-species.R#57: test_that("index_return provides indices for touched species", 
      {
          basis("CHNOS")
          expect_equal(species("CO2", index.return = TRUE), 1)
          expect_equal(species("CO2", index.return = TRUE), 1)
          expect_equal(species(c("H2O", "NH3"), index.return = TRUE), 
              c(2, 3))
          expect_equal(species(1, "gas", index.return = TRUE), 
              1)
      })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 43: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 44: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 36. Error: index_return provides indices for touched species (@test-species.R
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis("CHNOS")
   2. CHNOSZ:::preset.basis(species[1])
   3. CHNOSZ::basis(species, logact)
   4. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2: basis(species, logact)
  where 3: preset.basis(species[1])
  where 4 at testthat/test-subcrt.R#8: basis("CHNOS")
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test-subcrt.R#6: test_that("unbalanced reactions give a warning or are balanced given sufficient basis species", 
      {
          expect_warning(subcrt(c("glucose", "ethanol"), c(-1, 
              3)), "reaction was unbalanced, missing H-6O3")
          basis("CHNOS")
          s <- subcrt(c("malic acid", "citric acid"), c(-1, 1))
          expect_equal(s$reaction$coeff, c(-1, 1, -2, -1, 1.5))
          expect_equal(s$reaction$name, c("malic acid", "citric acid", 
              "CO2", "water", "oxygen"))
      })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 43: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 44: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 37. Error: unbalanced reactions give a warning or are balanced given sufficie
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis("CHNOS")
   2. CHNOSZ:::preset.basis(species[1])
   3. CHNOSZ::basis(species, logact)
   4. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2 at testthat/test-subcrt.R#161: basis(c("copper", "chalcocite"))
  where 3: eval(code, test_env)
  where 4: eval(code, test_env)
  where 5: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 6: doTryCatch(return(expr), name, parentenv, handler)
  where 7: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 8: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 11: tryCatchList(expr, classes, parentenv, handlers)
  where 12: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 13: test_code(desc, code, env = parent.frame())
  where 14 at testthat/test-subcrt.R#152: test_that("duplicated species yield correct phase transitions", 
      {
          s1 <- subcrt("chalcocite", T = c(100, 1000), P = 1000)
          s2 <- subcrt(rep("chalcocite", 2), T = c(100, 1000), 
              P = 1000)
          expect_equal(s1$out[[1]]$logK, s2$out[[1]]$logK)
          expect_equal(s1$out[[1]]$logK, s2$out[[2]]$logK)
          basis(c("copper", "chalcocite"))
          species("chalcocite")
          a <- affinity(T = c(0, 1000, 2), P = 1)
          expect_equal(as.numeric(a$values[[1]]), c(0, 0))
      })
  where 15: eval(code, test_env)
  where 16: eval(code, test_env)
  where 17: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 18: doTryCatch(return(expr), name, parentenv, handler)
  where 19: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 20: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 23: tryCatchList(expr, classes, parentenv, handlers)
  where 24: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 25: test_code(NULL, exprs, env)
  where 26: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 27: force(code)
  where 28: doWithOneRestart(return(expr), restart)
  where 29: withOneRestart(expr, restarts[[1L]])
  where 30: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 31: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 32: FUN(X[[i]], ...)
  where 33: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 34: force(code)
  where 35: doWithOneRestart(return(expr), restart)
  where 36: withOneRestart(expr, restarts[[1L]])
  where 37: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 38: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 39: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 40: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 41: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 38. Error: duplicated species yield correct phase transitions (@test-subcrt.R
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis(c("copper", "chalcocite"))
   2. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2: basis(species, logact)
  where 3: preset.basis(species[1])
  where 4 at testthat/test-swap.basis.R#8: basis("CHNOS+")
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test-swap.basis.R#6: test_that("swap.basis raises errors when needed", {
      expect_error(swap.basis(c("CO2", "H2O")), "requires an existing basis definition")
      basis("CHNOS+")
      expect_error(swap.basis(c("CO2", "H2O")), "two species must be identified")
      expect_error(swap.basis(c("CO2", "H2O"), c("HCO3-", "H2O")), 
          "can only swap one species for one species")
      expect_error(swap.basis("CH4", "C2H5OH"), "basis species .* is not defined")
      expect_error(swap.basis("CO2", "C60"), "is not available")
      expect_error(swap.basis("CO2", "H2"), "the number of basis species is greater than the number of elements and charge")
  })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 43: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 44: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 39. Error: swap.basis raises errors when needed (@test-swap.basis.R#8)  -----
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis("CHNOS+")
   2. CHNOSZ:::preset.basis(species[1])
   3. CHNOSZ::basis(species, logact)
   4. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2 at testthat/test-swap.basis.R#18: basis(c("graphite", "H2"), c("cr", "gas"))
  where 3: eval(code, test_env)
  where 4: eval(code, test_env)
  where 5: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 6: doTryCatch(return(expr), name, parentenv, handler)
  where 7: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 8: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 11: tryCatchList(expr, classes, parentenv, handlers)
  where 12: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 13: test_code(desc, code, env = parent.frame())
  where 14 at testthat/test-swap.basis.R#16: test_that("basis.logact only accepts defined elements", {
      basis(c("graphite", "H2"), c("cr", "gas"))
      expect_error(basis.logact(c(C = 1)), "number of elements in 'emu' is less than those in basis")
      ispecies <- info(c("ethane", "propane", "acetic acid", "propanoic acid"))
      w <- run.wjd(ispecies, as.chemical.formula(colMeans(i2A(ispecies))))
      ep <- equil.potentials(w)
      expect_error(basis.logact(ep), "element\\(s\\) O not found in basis")
  })
  where 15: eval(code, test_env)
  where 16: eval(code, test_env)
  where 17: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 18: doTryCatch(return(expr), name, parentenv, handler)
  where 19: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 20: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 23: tryCatchList(expr, classes, parentenv, handlers)
  where 24: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 25: test_code(NULL, exprs, env)
  where 26: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 27: force(code)
  where 28: doWithOneRestart(return(expr), restart)
  where 29: withOneRestart(expr, restarts[[1L]])
  where 30: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 31: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 32: FUN(X[[i]], ...)
  where 33: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 34: force(code)
  where 35: doWithOneRestart(return(expr), restart)
  where 36: withOneRestart(expr, restarts[[1L]])
  where 37: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 38: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 39: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 40: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 41: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 40. Error: basis.logact only accepts defined elements (@test-swap.basis.R#18)
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis(c("graphite", "H2"), c("cr", "gas"))
   2. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2 at testthat/test-swap.basis.R#30: basis(c("graphite", "H2", "O2"), c("cr", "gas", "gas"))
  where 3: eval(code, test_env)
  where 4: eval(code, test_env)
  where 5: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 6: doTryCatch(return(expr), name, parentenv, handler)
  where 7: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 8: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 11: tryCatchList(expr, classes, parentenv, handlers)
  where 12: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 13: test_code(desc, code, env = parent.frame())
  where 14 at testthat/test-swap.basis.R#29: test_that("equil.potentials - basis.logact - element.mu makes a roundtrip at 25 and 99 degrees C", 
      {
          basis(c("graphite", "H2", "O2"), c("cr", "gas", "gas"))
          ispecies <- info(c("ethane", "propane", "acetic acid", 
              "propanoic acid"))
          w25 <- run.wjd(ispecies, as.chemical.formula(colMeans(i2A(ispecies))))
          ep25 <- equil.potentials(w25)
          bl25 <- basis.logact(ep25)
          basis(names(bl25), bl25)
          expect_equal(element.mu(), ep25)
          w99 <- run.wjd(ispecies, as.chemical.formula(colMeans(i2A(ispecies))), 
              T = 99)
          ep99 <- equil.potentials(w99)
          bl99 <- basis.logact(ep99, T = 99)
          basis(names(bl99), bl99)
          expect_equal(element.mu(T = 99), ep99)
      })
  where 15: eval(code, test_env)
  where 16: eval(code, test_env)
  where 17: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 18: doTryCatch(return(expr), name, parentenv, handler)
  where 19: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 20: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 23: tryCatchList(expr, classes, parentenv, handlers)
  where 24: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 25: test_code(NULL, exprs, env)
  where 26: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 27: force(code)
  where 28: doWithOneRestart(return(expr), restart)
  where 29: withOneRestart(expr, restarts[[1L]])
  where 30: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 31: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 32: FUN(X[[i]], ...)
  where 33: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 34: force(code)
  where 35: doWithOneRestart(return(expr), restart)
  where 36: withOneRestart(expr, restarts[[1L]])
  where 37: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 38: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 39: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 40: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 41: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 41. Error: equil.potentials - basis.logact - element.mu makes a roundtrip at 
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis(c("graphite", "H2", "O2"), c("cr", "gas", "gas"))
   2. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2: basis(species, logact)
  where 3: preset.basis(species[1])
  where 4 at testthat/test-swap.basis.R#50: basis("FeCHNOS+")
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test-swap.basis.R#49: test_that("swapping works with a buffer (no recalculation of activities)", 
      {
          basis("FeCHNOS+")
          oldb <- basis("O2", "PPM")
          newb <- swap.basis("O2", "hydrogen")
          expect_identical(oldb$logact, newb$logact)
      })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 43: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 44: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 42. Error: swapping works with a buffer (no recalculation of activities) (@te
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis("FeCHNOS+")
   2. CHNOSZ:::preset.basis(species[1])
   3. CHNOSZ::basis(species, logact)
   4. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2: basis(species, logact)
  where 3: preset.basis(species[1])
  where 4 at testthat/test-util.affinity.R#20: basis("CHNOSe")
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test-util.affinity.R#14: test_that("A.ionization() handles arguments generated by energy.args()", 
      {
          basis("CHNOSe")
          ea <- energy.args(list(CO2 = c(-5, 0, 6), pH = c(0, 14, 
              2), Eh = c(-1, 0, 3), T = c(25, 28, 4)))
          A <- A.ionization(1, ea$vars, ea$vals)
          expect_equal(dim(A[[1]]), c(6, 2, 3, 4))
          ea <- energy.args(list(pH = c(0, 14, 2), Eh = c(-1, 0, 
              2)))
          A <- A.ionization(1, ea$vars, ea$vals)
          expect_equal(dim(A[[1]]), c(2, 2))
          A <- A.ionization(1, vars = character(), vals = list())
          expect_equal(dim(A[[1]]), 1)
      })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 43: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 44: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 43. Error: A.ionization() handles arguments generated by energy.args() (@test
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis("CHNOSe")
   2. CHNOSZ:::preset.basis(species[1])
   3. CHNOSZ::basis(species, logact)
   4. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2: basis(species, logact)
  where 3: preset.basis(species[1])
  where 4 at testthat/test-util.affinity.R#36: basis("CHNOS")
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test-util.affinity.R#34: test_that("energy() includes ionization affinities of proteins when needed", 
      {
          basis("CHNOS")
          species(c("alanine", "LYSC_CHICK"))
          ea <- energy.args(list(T = c(25, 50, 2), O2 = c(-80, 
              -60, 3)))
          Anonion <- do.call(energy, ea)
          basis("CHNOS+")
          basis("pH", 11)
          species(c("alanine", "LYSC_CHICK"))
          ea <- energy.args(list(T = c(25, 50, 2), O2 = c(-80, 
              -60, 3)))
          Aion.pH11 <- do.call(energy, ea)
          expect_equal(Anonion$a[[1]], Aion.pH11$a[[1]])
          A.ionization.LYSC_CHICK <- Aion.pH11$a[[2]] - Anonion$a[[2]]
          A.ionization.2550 <- ionize.aa(pinfo(pinfo("LYSC_CHICK")), 
              property = "A", T = c(25, 50), pH = 11)
          expect_equal(A.ionization.LYSC_CHICK[, 1], A.ionization.2550[, 
              1], check.attributes = FALSE)
          expect_equal(A.ionization.LYSC_CHICK[, 3], A.ionization.2550[, 
              1], check.attributes = FALSE)
      })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 43: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 44: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 44. Error: energy() includes ionization affinities of proteins when needed (@
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis("CHNOS")
   2. CHNOSZ:::preset.basis(species[1])
   3. CHNOSZ::basis(species, logact)
   4. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2: basis(species, logact)
  where 3: preset.basis(species[1])
  where 4 at testthat/test-util.program.R#20: basis("CHNOS")
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test-util.program.R#15: test_that("other functions are calling palply() properly", {
      if (min(getOption("mc.cores"), 2) > 1 & parallel::detectCores() > 
          1) {
          basis("CHNOS")
          ip <- 1:nrow(thermo()$protein)
          expect_message(a <- affinity(iprotein = rep(ip, 3)), 
              "affinity running .* calculations")
          expect_message(e <- equilibrate(a, normalize = TRUE), 
              "equil.boltzmann running .* calculations")
          species(c("CO2", "acetic acid"))
          a <- affinity(O2 = c(-90, -60, 1000))
          expect_message(e <- equilibrate(a), "equil.reaction running 1000 calculations")
      }
  })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 43: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 44: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 45. Error: other functions are calling palply() properly (@test-util.program.
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis("CHNOS")
   2. CHNOSZ:::preset.basis(species[1])
   3. CHNOSZ::basis(species, logact)
   4. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2 at testthat/test-water.lines.R#20: basis(c("H2O", "H+", "e-"), c(logaH2O[i], -7, -7))
  where 3: eval(code, test_env)
  where 4: eval(code, test_env)
  where 5: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 6: doTryCatch(return(expr), name, parentenv, handler)
  where 7: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 8: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 11: tryCatchList(expr, classes, parentenv, handlers)
  where 12: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 13: test_code(desc, code, env = parent.frame())
  where 14 at testthat/test-water.lines.R#14: test_that("water.lines() masks H2 and O2 fields on diagrams with pH as x-axis", 
      {
          if (plot.it) 
              par(mfrow = c(3, 6))
          Ts <- c(25, 100, 25)
          logaH2O <- c(0, 0, -5)
          for (i in 1:3) {
              T <- Ts[i]
              basis(c("H2O", "H+", "e-"), c(logaH2O[i], -7, -7))
              species(c("H2O", "O2", "H2"), c("liq", "gas", "gas"))
              n1 <- nspecies(affinity(pH = c(-2, 16, res), Eh = c(-1, 
                  1.5, res), T = T))
              n2 <- nspecies(affinity(pH = c(-2, 16, res), pe = c(-20, 
                  25, res), T = T))
              swap.basis("e-", "oxygen")
              n3 <- nspecies(affinity(pH = c(-2, 16, res), O2 = c(-90, 
                  10, res), T = T))
              swap.basis("oxygen", "O2")
              n4 <- nspecies(affinity(pH = c(-2, 16, res), O2 = c(-90, 
                  10, res), T = T))
              swap.basis("O2", "hydrogen")
              n5 <- nspecies(affinity(pH = c(-2, 16, res), H2 = c(-50, 
                  10, res), T = T))
              swap.basis("hydrogen", "H2")
              n6 <- nspecies(affinity(pH = c(-2, 16, res), H2 = c(-50, 
                  10, res), T = T))
              expect_equal(c(n1, n2, n3, n4, n5, n6), c(1, 1, 1, 
                  1, 1, 1))
          }
      })
  where 15: eval(code, test_env)
  where 16: eval(code, test_env)
  where 17: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 18: doTryCatch(return(expr), name, parentenv, handler)
  where 19: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 20: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 23: tryCatchList(expr, classes, parentenv, handlers)
  where 24: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 25: test_code(NULL, exprs, env)
  where 26: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 27: force(code)
  where 28: doWithOneRestart(return(expr), restart)
  where 29: withOneRestart(expr, restarts[[1L]])
  where 30: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 31: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 32: FUN(X[[i]], ...)
  where 33: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 34: force(code)
  where 35: doWithOneRestart(return(expr), restart)
  where 36: withOneRestart(expr, restarts[[1L]])
  where 37: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 38: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 39: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 40: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 41: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 46. Error: water.lines() masks H2 and O2 fields on diagrams with pH as x-axis
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis(c("H2O", "H+", "e-"), c(logaH2O[i], -7, -7))
   2. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2 at testthat/test-water.lines.R#43: basis(c("H2O", "H+", "e-"), c(0, -7, -7))
  where 3: eval(code, test_env)
  where 4: eval(code, test_env)
  where 5: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 6: doTryCatch(return(expr), name, parentenv, handler)
  where 7: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 8: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 11: tryCatchList(expr, classes, parentenv, handlers)
  where 12: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 13: test_code(NULL, exprs, env)
  where 14: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 15: force(code)
  where 16: doWithOneRestart(return(expr), restart)
  where 17: withOneRestart(expr, restarts[[1L]])
  where 18: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 19: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 20: FUN(X[[i]], ...)
  where 21: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 22: force(code)
  where 23: doWithOneRestart(return(expr), restart)
  where 24: withOneRestart(expr, restarts[[1L]])
  where 25: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 26: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 27: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 28: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 29: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 30: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 47. Error: (unknown) (@test-water.lines.R#43)  ------------------------------
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis(c("H2O", "H+", "e-"), c(0, -7, -7))
   2. CHNOSZ:::put.basis(ispecies, logact)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  CHNOSZ
   --- call from context --- 
  put.basis(ispecies, logact)
   --- call from argument --- 
  if (class(try(solve(comp), silent = TRUE)) == "try-error") stop("singular stoichiometric matrix")
   --- R stacktrace ---
  where 1: put.basis(ispecies, logact)
  where 2: basis(species, logact)
  where 3: preset.basis(species[1])
  where 4 at testthat/test-wjd.R#52: basis("CHNOS")
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test-wjd.R#21: test_that("open-system equilibrium distributions reproduce the results of wjd()", 
      {
          reset()
          add.obigt("OldAA")
          y <- yeastgfp("lipid.particle")
          aa <- yeast.aa(y$protein)
          ina <- is.na(y$abundance) | is.na(aa$chains)
          aa <- aa[!ina, ]
          aa.625 <- aa[, 6:25]
          aa[, 6:25] <- aa.625/rowSums(aa.625)
          iprotein <- add.protein(aa)
          iobigt <- info(paste(aa$protein, aa$organism, sep = "_"))
          Y <- rep(100, length(iobigt))
          w <- run.wjd(iobigt, Y = Y, Gfrac = 1e-15, nlambda = 501)
          X.closed <- w$X
          ep <- equil.potentials(w)
          basis("CHNOS")
          bl <- basis.logact(ep)
          basis(names(bl), bl)
          a <- affinity(iprotein = iprotein)
          e <- equilibrate(a, loga.balance = log10(sum(Y)))
          X.open <- 10^unlist(e$loga.equil)
          expect_equal(X.closed, X.open, tolerance = 0.018)
          reset()
      })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 43: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 44: test_check("CHNOSZ")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (ispecies, logact = rep(NA, length(ispecies))) 
  {
      thermo <- get("thermo", CHNOSZ)
      state <- thermo$obigt$state[ispecies]
      comp <- makeup(ispecies, count.zero = TRUE)
      comp <- sapply(comp, c)
      comp <- t(comp)
      rownames(comp) <- as.character(thermo$obigt$formula[ispecies])
      if ("(Z-1)" %in% rownames(comp)) 
          rownames(comp)[rownames(comp) == "(Z-1)"] <- "e-"
      if (nrow(comp) > ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is greater than the number of elements and charge")
          else stop("the number of basis species is greater than the number of elements")
      }
      if (nrow(comp) < ncol(comp)) {
          if ("Z" %in% colnames(comp)) 
              stop("the number of basis species is less than the number of elements and charge")
          else stop("the number of basis species is less than the number of elements")
      }
      if (class(try(solve(comp), silent = TRUE)) == "try-error") 
          stop("singular stoichiometric matrix")
      comp <- cbind(as.data.frame(comp), ispecies, logact, state, 
          stringsAsFactors = FALSE)
      thermo$basis <- comp
      assign("thermo", thermo, CHNOSZ)
      species(delete = TRUE)
      return(thermo$basis)
  }
  <bytecode: 0x4407e60>
  <environment: namespace:CHNOSZ>
   --- function search by body ---
  Function put.basis in namespace CHNOSZ has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 48. Error: open-system equilibrium distributions reproduce the results of wjd
  the condition has length > 1
  Backtrace:
   1. CHNOSZ::basis("CHNOS")
   2. CHNOSZ:::preset.basis(species[1])
   3. CHNOSZ::basis(species, logact)
   4. CHNOSZ:::put.basis(ispecies, logact)
  
  == testthat results  ===========================================================
  [ OK: 365 | SKIPPED: 0 | WARNINGS: 1 | FAILED: 48 ]
  1. Error: errors come as expected (@test-affinity.R#10) 
  2. Error: output gives T and P in user's units (@test-affinity.R#18) 
  3. Error: pe, pH and Eh are correctly handled (@test-affinity.R#36) 
  4. Error: affinity() in 3D returns values consistent with manual calculation (@test-affinity.R#77) 
  5. Error: 'iprotein' gives consistent results on a transect (@test-affinity.R#108) 
  6. Error: affinity() for proteins (with/without 'iprotein') returns same value as in previous package versions (@test-affinity.R#136) 
  7. Error: affinity() for proteins keeps track of pH on 2-D calculations (@test-affinity.R#152) 
  8. Error: IS can be constant or variable (@test-affinity.R#166) 
  9. Error: argument recall is usable (@test-affinity.R#178) 
  1. ...
  
  Error: testthat unit tests failed
  Execution halted