diff --git a/hydrus/file_manip_fcn.R b/hydrus/file_manip_fcn.R
index 882994b9f5ebc5e0e2334b0a41dca66aee03264c..810ad6bbd6c851be548bf520b4894642848f554d 100644
--- a/hydrus/file_manip_fcn.R
+++ b/hydrus/file_manip_fcn.R
@@ -221,7 +221,45 @@ modify.inputs <- function(input.file.path, line.number, new.file.path, new.line)
   return(file.after)
 }
 
+modify.input <- function(path, working.folder){
+  # path: the path to the parameter json file (see parameter.file.creator)
+  
+  # load necessary librairies
+  library(rjson)
+  # read the json parameter file
+  parameter <- fromJSON(file = path)
+  # the number of simulations is the length of the parameter list
+  nb.simul <- length(parameter)
+  # iterate on the number of simulations
+  for (i in 1:nb.simul){
+    # path to the file to be modified
+    input.file.path <- paste0(working.folder,"//","simulation","_",as.character(i),"//",parameter[[i]]$file.name)
+    # open the connection
+    con <- file(input.file.path)
+    # read all file lines
+    file.content <- readLines(con, n=-1)
+    # close the connection
+    close(con)
+    # lines that remained unchanged before the line to be modified
+    file.before <- file.content[1:parameter[[i]]$line.number-1]
+    # lines that remained unchanged after the line to be modified
+    file.after <- file.content[parameter[[i]]$line.number+1:length(file.content)]
+    # open connection again
+    con <- file(input.file.path, "w")
+    # write lines that remained unchanged before
+    writeLines(file.before, con)
+    # write the line that has been modified
+    writeLines(parameter[[i]]$new.line, con)
+    # write lines that remained unchanged after
+    writeLines(file.after, con)
+    # close connection
+    close(con)
+  }
+}
+
 parameter.file.creator <- function(path, reference.model.folder){
+  # path: the path to the json parameter file to be created
+  # reference.model.folder: the reference.model.folder containing the orginal input files
   # load necesary libraries
   library(rjson)
   library(tidyverse)
diff --git a/hydrus/main_script.R b/hydrus/main_script.R
index 5b53f69822f23b6104bb7ae3d39ad0e233dcd690..ad329f38e8815694c460c2147a6f08ed93a6bd28 100644
--- a/hydrus/main_script.R
+++ b/hydrus/main_script.R
@@ -1,4 +1,4 @@
-hydrus.batch <- function(setup.file, HP1 = FALSE){
+hydrus.batch <- function(setup.file, parameter.file HP1 = FALSE){
   #--------- load necessary libraries ----------#
   library(fs)
   library(rjson)
@@ -58,9 +58,8 @@ hydrus.batch <- function(setup.file, HP1 = FALSE){
     dir_copy(path = setup$reference.model.folder,
              new_path = paste0(setup$working.folder,"/","simulation","_",as.character(i)), overwrite = TRUE)
   
-    # modify input files (cette fonction est à construire. Elle doit être précédée par une fonction permettant de créer le fichier json des paramètres)
-    modify.input(parameter.file, path = setup$reference.model.folder,
-                 new_path = paste0(setup$working.folder,"/","simulation","_",as.character(i)))
+    # modify input files
+    modify.input(path = parameter.file, working.foler = setup$working.folder)
   
     # create level_01.dir (and path.dat)
     level_01.creator(paste0(setup$working.folder,"/","simulation","_",as.character(i)), HP1 = HP1)