Diversity in emergent cell locomotion from the coupling cytosolic and cortical Marangoni flows with reaction-diffusion dynamics.
Paper
Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
C · 1,327 lines · 56 KB · MIT
- /* SPDX-License-Identifier: MIT */
- /*
- * Project: CellRDA-LS (Mechanochemical cell motility simulations)
- * File: main.c
- * Brief: Program entry point; parses JSON parameters and runs batch simulations.
- *
- * Author: Blaž Ivšić
- * Contact: [email hidden]
- * Copyright: (c) 2023–2025 Blaž Ivšić
- *
- * License: MIT — see LICENSE in the repository root.
- *
- * How to cite:
- * Article: Diversity in emergent cell locomotion from the coupling cytosolic and cortical Marangoni flows with reaction–diffusion dynamics, <Journal or preprint>, <Year>. DOI: <paper DOI>
- * Software: Cite this release via CITATION.cff (and Zenodo DOI if minted).
- *
- * Reproducibility:
- * - Language/Std: C11
- * - Compiler: gcc >= 12 and/or clang >= 16 (tested)
- * - Dependencies: NetCDF >= 4.9 (with HDF5), cJSON (vendored), -lm
- * - Optional: OpenMP, AVX2 (guard with feature flags)
- * - Inputs: SimulationParameters_X.json, InitialConditions_X.nc
- * - Outputs: <files>.nc/.bin/.txt (see README)
- * - Determinism: set Seed=<int> to reproduce stochastic runs
- *
- * Version: v1.0.0 | Commit: <git short SHA> | Date: <YYYY-MM-DD>
- * Build (ex): gcc -O3 -std=c11 -fopenmp -Ithird_party/cJSON \
- * src/*.c third_party/cJSON/cJSON.c \
- * -lnetcdf -lhdf5 -lm -o program
- */
- #include <stdio.h>
- #include <stdlib.h>
- #include <netcdf.h>
- #include <string.h>
- #include <math.h>
- #include <time.h>
- #include "cJSON.h"
- #include "simulation.h"
- #define chcJSONitem(item, name) \
- if ((item) == NULL) { \
- printf("Error: Missing or invalid value for key: %s\n", name); \
- return 11; \
- }
- #define ALLOC_ARRAY(name, type, rows, cols) \
- type *name = (type *)calloc((rows) * (cols), sizeof(type)); \
- if (name == NULL) \
- { \
- printf("Memory allocation failed for " #name "\n"); \
- \
- exit(EXIT_FAILURE); \
- }
- char *readJSON(const char *filename)
- {
- //Function for loading JSON file
- FILE *file = fopen(filename, "r");
- if(!file)
- {
- printf("Error: Failed to open the file\n");
- return NULL;
- }
- // Determining length of the file
- fseek(file, 0, SEEK_END);
- long length = ftell(file);
- fseek(file, 0, SEEK_SET);
- // Memory allocation
- char *content = (char *)malloc(length + 1); // While this makes the cast explicit, it's not required in C, and omitting the cast is typically the preferred approach in modern C programming.
- // ChatGPT: This was common in older versions of C or when using C++ compilers, which are stricter about type conversions. However, in modern C compilers, the cast is generally not necessary because malloc returns a void *, which can be assigned to any pointer type without a cast.
- fread(content, 1, length, file);
- fclose(file);
- content[length] = '\0';
- return content;
- }
- cJSON* loadJSON(const char* filename)
- {
- // Function for loading the JSON data
- char *JSONcontent = readJSON(filename);
- if (!JSONcontent)
- {
- printf("Error: Failed to read the file\n");
- return NULL;
- }
- // Parsing file content
- cJSON *json = cJSON_Parse(JSONcontent);
- free(JSONcontent);
- if (json == NULL) {
- printf("Error: Failed to parse JSON\n");
- return NULL;
- }
- return json;
- }
- int validateArray(cJSON *array, int expectedSize, const char *keyName) {
- if (array == NULL || array->type != cJSON_Array || cJSON_GetArraySize(array) != expectedSize) {
- printf("Error: Missing or invalid array for key: %s (expected size: %d)\n", keyName, expectedSize);
- return 11; // Error code for missing or invalid array
- }
- for (int i = 0; i < expectedSize; i++) {
- cJSON *item = cJSON_GetArrayItem(array, i);
- if (item == NULL || item->type != cJSON_Number) {
- printf("Error: Invalid value at index %d in array for key: %s\n", i, keyName);
- return 12; // Error code for invalid array value
- }
- }
- return 0; // Validation successful
- }
- int validateParameters(cJSON *json) {
- // Function for checking JSON keys
- // File parameters
- cJSON *FileParameters = cJSON_GetObjectItem(json, "FileParameters");
- chcJSONitem(FileParameters, "FileParameters");
- chcJSONitem(cJSON_GetObjectItem(FileParameters, "InitialFile"), "InitialFile");
- chcJSONitem(cJSON_GetObjectItem(FileParameters, "SaveFile"), "SaveFile");
- chcJSONitem(cJSON_GetObjectItem(FileParameters, "TracerFolder"), "TracerFolder");
- chcJSONitem(cJSON_GetObjectItem(FileParameters, "TracerPrefix"), "TracerPrefix");
- // Simulation parameters
- cJSON *SimulationParameters = cJSON_GetObjectItem(json, "SimulationParameters");
- chcJSONitem(SimulationParameters, "SimulationParameters");
- chcJSONitem(cJSON_GetObjectItem(SimulationParameters, "Cluster"), "Cluster");
- chcJSONitem(cJSON_GetObjectItem(SimulationParameters, "Seed"), "Seed");
- chcJSONitem(cJSON_GetObjectItem(SimulationParameters, "NumberOfTracersBulk"), "NumberOfTracersBulk");
- chcJSONitem(cJSON_GetObjectItem(SimulationParameters, "NumberOfTracersOut"), "NumberOfTracersOut");
- chcJSONitem(cJSON_GetObjectItem(SimulationParameters, "NumberOfSaveCycles"), "NumberOfSaveCycles");
- chcJSONitem(cJSON_GetObjectItem(SimulationParameters, "NumberOfDoubleStep"), "NumberOfDoubleStep");
- chcJSONitem(cJSON_GetObjectItem(SimulationParameters, "NumberOfPointsX"), "NumberOfPointsX");
- chcJSONitem(cJSON_GetObjectItem(SimulationParameters, "NumberOfPointsY"), "NumberOfPointsY");
- chcJSONitem(cJSON_GetObjectItem(SimulationParameters, "GridSpacingX"), "GridSpacingX");
- chcJSONitem(cJSON_GetObjectItem(SimulationParameters, "GridSpacingY"), "GridSpacingY");
- chcJSONitem(cJSON_GetObjectItem(SimulationParameters, "TimeStepSpacing"), "TimeStepSpacing");
- chcJSONitem(cJSON_GetObjectItem(SimulationParameters, "CutOff"), "CutOff");
- chcJSONitem(cJSON_GetObjectItem(SimulationParameters, "PotentialCutOffBulk"), "PotentialCutOffBulk");
- chcJSONitem(cJSON_GetObjectItem(SimulationParameters, "PotentialCutOffSurface"), "PotentialCutOffSurface");
- chcJSONitem(cJSON_GetObjectItem(SimulationParameters, "MaxIterations"), "MaxIterations");
- chcJSONitem(cJSON_GetObjectItem(SimulationParameters, "PressTol"), "PressTol");
- // Model Parameters
- cJSON *ModelParameters = cJSON_GetObjectItem(json, "ModelParameters");
- chcJSONitem(ModelParameters, "ModelParameters");
- chcJSONitem(cJSON_GetObjectItem(ModelParameters, "Epsilon"), "Epsilon");
- chcJSONitem(cJSON_GetObjectItem(ModelParameters, "Viscosity"), "Viscosity");
- chcJSONitem(cJSON_GetObjectItem(ModelParameters, "Gamma"), "Gamma");
- chcJSONitem(cJSON_GetObjectItem(ModelParameters, "SurfaceTension"), "SurfaceTension");
- chcJSONitem(cJSON_GetObjectItem(ModelParameters, "SurfaceTensionCoefficient"), "SurfaceTensionCoefficient");
- chcJSONitem(cJSON_GetObjectItem(ModelParameters, "SubstrateForceCoefficient"), "SubstrateForceCoefficient");
- chcJSONitem(cJSON_GetObjectItem(ModelParameters, "Dissipation"), "Dissipation");
- chcJSONitem(cJSON_GetObjectItem(ModelParameters, "AreaConstraint"), "AreaConstraint");
- chcJSONitem(cJSON_GetObjectItem(ModelParameters, "Rac1Max"), "Rac1Max");
- cJSON *DiffusionArray = cJSON_GetObjectItem(cJSON_GetObjectItem(ModelParameters, "Diffusion"), "value");
- cJSON *ReactionsArray = cJSON_GetObjectItem(cJSON_GetObjectItem(ModelParameters, "Reactions"), "value");
- int chcDiff = validateArray(DiffusionArray, 4, "Diffusion");
- if (chcDiff != 0) {return chcDiff;}
- int chcReac = validateArray(ReactionsArray, 5, "Reactions");
- if (chcReac != 0) {return chcReac;}
- return 0; // Validation successful
- }
- int loadParameters(cJSON *json,
- char *InitialConditionsFile, char *SaveFileName, char *TracerFolder, char * TracerPrefix,
- int *Seed, int *Cluster, int *nTracersB, int *nTracersO, int *NumberOfSaveCycles, int *NumberOfDoubleStep,
- size_t *I, size_t *J,
- double *dx, double *dy, double *dt, double *CO, double *vBB, double *vBS, int *MaxIter, double *PTol,
- double *eps, double *nu, double *cG, double *Si0, double *kSi, double *kC, double *Beta, double *Alpha,
- double *DRD, double *DRT, double *DG, double *DGc,
- double *k1, double *k2, double *k3, double *k11, double *k12, double *R_Max)
- {
- // Function for loading parameters from .json content
- // The Parameters are split into groups depending on the type of data
- // If new parameters are added the type of parameter to be loaded needs to be specified accordingly even dough the type is specified in .json file.
- // Checking the compatibility of JOSN file
- int chcVAL = validateParameters(json);
- if (chcVAL != 0) {return chcVAL;}
- // Loading JSON fields
- cJSON *FileParameters = cJSON_GetObjectItem(json, "FileParameters");
- cJSON *SimulationParameters = cJSON_GetObjectItem(json, "SimulationParameters");
- cJSON *ModelParameters = cJSON_GetObjectItem(json, "ModelParameters");
- // File parameters
- strcpy(InitialConditionsFile, cJSON_GetObjectItem(cJSON_GetObjectItem(FileParameters, "InitialFile"), "value")->valuestring);
- strcpy(SaveFileName, cJSON_GetObjectItem(cJSON_GetObjectItem(FileParameters, "SaveFile"), "value")->valuestring);
- strcpy(TracerFolder, cJSON_GetObjectItem(cJSON_GetObjectItem(FileParameters, "TracerFolder"), "value")->valuestring);
- strcpy(TracerPrefix, cJSON_GetObjectItem(cJSON_GetObjectItem(FileParameters, "TracerPrefix"), "value")->valuestring);
- // Simulation parameters
- *Cluster = cJSON_GetObjectItem(cJSON_GetObjectItem(SimulationParameters, "Cluster"), "value")->valueint;
- *Seed = cJSON_GetObjectItem(cJSON_GetObjectItem(SimulationParameters, "Seed"), "value")->valueint;
- *nTracersB = cJSON_GetObjectItem(cJSON_GetObjectItem(SimulationParameters, "NumberOfTracersBulk"), "value")->valueint;
- *nTracersO = cJSON_GetObjectItem(cJSON_GetObjectItem(SimulationParameters, "NumberOfTracersOut"), "value")->valueint;
- *NumberOfSaveCycles = cJSON_GetObjectItem(cJSON_GetObjectItem(SimulationParameters, "NumberOfSaveCycles"), "value")->valueint;
- *NumberOfDoubleStep = cJSON_GetObjectItem(cJSON_GetObjectItem(SimulationParameters, "NumberOfDoubleStep"), "value")->valueint;
- *I = cJSON_GetObjectItem(cJSON_GetObjectItem(SimulationParameters, "NumberOfPointsX"), "value")->valueint;
- *J = cJSON_GetObjectItem(cJSON_GetObjectItem(SimulationParameters, "NumberOfPointsY"), "value")->valueint;
- *dx = cJSON_GetObjectItem(cJSON_GetObjectItem(SimulationParameters, "GridSpacingX"), "value")->valuedouble;
- *dy = cJSON_GetObjectItem(cJSON_GetObjectItem(SimulationParameters, "GridSpacingY"), "value")->valuedouble;
- *dt = cJSON_GetObjectItem(cJSON_GetObjectItem(SimulationParameters, "TimeStepSpacing"), "value")->valuedouble;
- *CO = cJSON_GetObjectItem(cJSON_GetObjectItem(SimulationParameters, "CutOff"), "value")->valuedouble;
- *vBB = cJSON_GetObjectItem(cJSON_GetObjectItem(SimulationParameters, "PotentialCutOffBulk"), "value")->valuedouble;
- *vBS = cJSON_GetObjectItem(cJSON_GetObjectItem(SimulationParameters, "PotentialCutOffSurface"), "value")->valuedouble;
- *MaxIter = cJSON_GetObjectItem(cJSON_GetObjectItem(SimulationParameters, "MaxIterations"), "value")->valueint;
- *PTol = cJSON_GetObjectItem(cJSON_GetObjectItem(SimulationParameters, "PressTol"), "value")->valuedouble;
- // Model Parameters
- *eps = cJSON_GetObjectItem(cJSON_GetObjectItem(ModelParameters, "Epsilon"), "value")->valuedouble;
- *nu = cJSON_GetObjectItem(cJSON_GetObjectItem(ModelParameters, "Viscosity"), "value")->valuedouble;
- *cG = cJSON_GetObjectItem(cJSON_GetObjectItem(ModelParameters, "Gamma"), "value")->valuedouble;
- *Si0 = cJSON_GetObjectItem(cJSON_GetObjectItem(ModelParameters, "SurfaceTension"), "value")->valuedouble;
- *kSi = cJSON_GetObjectItem(cJSON_GetObjectItem(ModelParameters, "SurfaceTensionCoefficient"), "value")->valuedouble;
- *kC = cJSON_GetObjectItem(cJSON_GetObjectItem(ModelParameters, "SubstrateForceCoefficient"), "value")->valuedouble;
- *Beta = cJSON_GetObjectItem(cJSON_GetObjectItem(ModelParameters, "Dissipation"), "value")->valuedouble;
- *Alpha = cJSON_GetObjectItem(cJSON_GetObjectItem(ModelParameters, "AreaConstraint"), "value")->valuedouble;
- cJSON *diffusion = cJSON_GetObjectItem(cJSON_GetObjectItem(ModelParameters, "Diffusion"), "value");
- double Diffusion[4];
- for (int i = 0; i < 4; i++) {
- Diffusion[i] = cJSON_GetArrayItem(diffusion, i)->valuedouble;
- }
- *DRD = Diffusion[0];
- *DRT = Diffusion[1];
- *DG = Diffusion[2];
- *DGc = Diffusion[3];
- cJSON *reactions = cJSON_GetObjectItem(cJSON_GetObjectItem(ModelParameters, "Reactions"), "value");
- double Reactions[5];
- for (int i = 0; i < 5; i++) {
- Reactions[i] = cJSON_GetArrayItem(reactions, i)->valuedouble;
- }
- *k1 = Reactions[0];
- *k2 = Reactions[1];
- *k3 = Reactions[2];
- *k11 = Reactions[3];
- *k12 = Reactions[4];
- *R_Max = cJSON_GetObjectItem(cJSON_GetObjectItem(ModelParameters, "Rac1Max"), "value")->valuedouble;
- return 0;
- }
- int checkSolutionFile(const char* SaveFileName)
- {
- // Function for checking if the solution exists and where has simulation terminated.
- int ncID, timeVarID;
- int RetVAL;
- size_t Len;
- // Try to open the solutions file
- RetVAL = nc_open(SaveFileName, NC_NOWRITE, &ncID);
- if (RetVAL == 2)
- {
- return -1; //The code that signals there is no Solution file
- }
- else if (RetVAL != NC_NOERR)
- {
- printf("Error opening file: %s\n", nc_strerror(RetVAL));
- return -30;
- }
- // Get the ID of the "Time" variable
- if (nc_inq_varid(ncID, "Time", &timeVarID) != NC_NOERR)
- {
- nc_close(ncID);
- return -31; // Time variable not found
- }
- // Get the length of the "Time" variable
- RetVAL = nc_inq_dimlen(ncID, timeVarID, &Len);
- if (RetVAL != NC_NOERR)
- {
- printf("Error: Time dimension not found in the file. %s\n", nc_strerror(RetVAL));
- nc_close(ncID);
- return -32; // Can't fetch the length of "Time" variable
- }
- // Allocate memory to hold the "Time" values
- double *TimeValues = (double *)malloc(Len * sizeof(double));
- if (TimeValues == NULL)
- {
- nc_close(ncID);
- return -98;
- }
- // Read the "Time" values
- if (nc_get_var_double(ncID, timeVarID, TimeValues) != NC_NOERR)
- {
- printf("Error reading Time vector: %s\n", nc_strerror(RetVAL));
- free(TimeValues);
- nc_close(ncID);
- return -33;
- }
- // Find the last index where the value is below the threshold
- int LastIndex = -1;
- for (size_t i = 0; i < Len; i++)
- {
- if (TimeValues[i] < 1e10)
- {
- LastIndex = i;
- }
- else
- {
- break;
- }
- }
- // Clean up
- free(TimeValues);
- nc_close(ncID);
- return LastIndex;
- }
- int readICNetCDF(const char *InitialConditionsFile)
- {
- // Function for opening NetCDF File
- int ncID, RetVAL;
- // Open the NetCDF file and assign the result to RetVAL
- RetVAL = nc_open(InitialConditionsFile, NC_NOWRITE, &ncID);
- if (RetVAL != NC_NOERR) // Check if an error occurred
- {
- printf("Error opening file: %s\n", nc_strerror(RetVAL));
- return -30;
- }
- // Return the NetCDF ID if successful
- return ncID;
- }
- int loadICNetCDF(int ncID, int *varID_Vx, int *varID_Vy, int *varID_Phi, int *varID_C_RD, int *varID_C_RT, int *varID_C_G, int *varID_C_Gc, int *varID_X, int *varID_Y)
- {
- // Function for loading NetCDF files for initial condition.
- // This function will return variable IDs and check if the needed initial condition matrices are included in the file.
- int RetVAL;
- RetVAL = nc_inq_varid(ncID, "Vx", varID_Vx);
- if (RetVAL != NC_NOERR)
- {
- printf("Error: Vx matrix not found in the file. %s\n", nc_strerror(RetVAL));
- return -31;
- }
- RetVAL = nc_inq_varid(ncID, "Vy", varID_Vy);
- if (RetVAL != NC_NOERR)
- {
- printf("Error: Vy matrix not found in the file. %s\n", nc_strerror(RetVAL));
- return -31;
- }
- RetVAL = nc_inq_varid(ncID, "Phi", varID_Phi);
- if (RetVAL != NC_NOERR)
- {
- printf("Error: Phi matrix not found in the file. %s\n", nc_strerror(RetVAL));
- return -31;
- }
- RetVAL = nc_inq_varid(ncID, "RD", varID_C_RD);
- if (RetVAL != NC_NOERR)
- {
- printf("Error: C_RD matrix not found in the file. %s\n", nc_strerror(RetVAL));
- return -31;
- }
- RetVAL = nc_inq_varid(ncID, "RT", varID_C_RT);
- if (RetVAL != NC_NOERR)
- {
- printf("Error: C_RT matrix not found in the file. %s\n", nc_strerror(RetVAL));
- return -31;
- }
- RetVAL = nc_inq_varid(ncID, "G", varID_C_G);
- if (RetVAL != NC_NOERR)
- {
- printf("Error: C_G matrix not found in the file. %s\n", nc_strerror(RetVAL));
- return -31;
- }
- RetVAL = nc_inq_varid(ncID, "Gc", varID_C_Gc);
- if (RetVAL != NC_NOERR)
- {
- printf("Error: C_Gc matrix not found in the file. %s\n", nc_strerror(RetVAL));
- return -31;
- }
- RetVAL = nc_inq_varid(ncID, "X", varID_X);
- if (RetVAL != NC_NOERR)
- {
- printf("Error: X vector not found in the file. %s\n", nc_strerror(RetVAL));
- return -31;
- }
- RetVAL = nc_inq_varid(ncID, "Y", varID_Y);
- if (RetVAL != NC_NOERR)
- {
- printf("Error: Y vector not found in the file. %s\n", nc_strerror(RetVAL));
- return -31;
- }
- return 0;
- }
- int checkICDimensions(int ncID, size_t I, size_t J)
- {
- // This function checks if the dimensions of initial conditions and ones specified in the parameters .json file are compatible
- int RetVAL;
- size_t FileI, FileJ;
- int xDim, yDim;
- RetVAL = nc_inq_dimid(ncID, "xDim", &xDim);
- if (RetVAL != NC_NOERR)
- {
- printf("Error: xDim dimenison not found in the file. %s\n", nc_strerror(RetVAL));
- return -32;
- }
- RetVAL = nc_inq_dimid(ncID, "yDim", &yDim);
- if (RetVAL != NC_NOERR)
- {
- printf("Error: yDim dimension not found in the file. %s\n", nc_strerror(RetVAL));
- return -32;
- }
- RetVAL = nc_inq_dimlen(ncID, xDim, &FileI);
- if (RetVAL != NC_NOERR)
- {
- printf("Error: Failed to obtain xDim %s\n", nc_strerror(RetVAL));
- return -32;
- }
- RetVAL = nc_inq_dimlen(ncID, yDim, &FileJ);
- if (RetVAL != NC_NOERR)
- {
- printf("Error: Failed to obtain yDim %s\n", nc_strerror(RetVAL));
- return -32;
- }
- if(I != FileI || J != FileJ)
- {
- printf("Error: Initial Conditions File dimensions not compatible with Parameters File.\n");
- return -97;
- }
- return 0;
- }
- int loadInitialConditions(const char *InitialConditionsFile, size_t I, size_t J,
- double *Vx, double *Vy, double *Phi, double *C_RD, double *C_RT, double *C_G, double *C_Gc,
- double *X, double *Y)
- {
- // Function for loading initial conditions.
- int varID_Vx, varID_Vy, varID_Phi, varID_C_RD, varID_C_RT, varID_C_G, varID_C_Gc, varID_X, varID_Y;
- int ncID, RetVAL;
- // Retrieving initial conditions file ID
- ncID = readICNetCDF(InitialConditionsFile);
- if (ncID == -30) { return -30; }
- // Retrieving variable IDs from initial conditions file
- RetVAL = loadICNetCDF(ncID, &varID_Vx, &varID_Vy, &varID_Phi, &varID_C_RD, &varID_C_RT, &varID_C_G, &varID_C_Gc, &varID_X, &varID_Y);
- if (RetVAL != 0) { nc_close(ncID); return RetVAL;}
- // Checking if dimensions in initial conditions file match those in parameters file
- RetVAL = checkICDimensions(ncID,I,J);
- if (RetVAL != 0) { nc_close(ncID); return RetVAL; }
- // Loading initial conditions matrices
- RetVAL = nc_get_var_double(ncID, varID_Vx, Vx);
- if (RetVAL != NC_NOERR)
- {
- printf("Error reading Vx matrix: %s\n", nc_strerror(RetVAL));
- nc_close(ncID);
- return -33;
- }
- RetVAL = nc_get_var_double(ncID, varID_Vy, Vy);
- if (RetVAL != NC_NOERR)
- {
- printf("Error reading Vy matrix: %s\n", nc_strerror(RetVAL));
- nc_close(ncID);
- return -33;
- }
- RetVAL = nc_get_var_double(ncID, varID_Phi, Phi);
- if (RetVAL != NC_NOERR)
- {
- printf("Error reading Phi matrix: %s\n", nc_strerror(RetVAL));
- nc_close(ncID);
- return -33;
- }
- RetVAL = nc_get_var_double(ncID, varID_C_RD, C_RD);
- if (RetVAL != NC_NOERR)
- {
- printf("Error reading C_RD matrix: %s\n", nc_strerror(RetVAL));
- nc_close(ncID);
- return -33;
- }
- RetVAL = nc_get_var_double(ncID, varID_C_RT, C_RT);
- if (RetVAL != NC_NOERR)
- {
- printf("Error reading C_RT matrix: %s\n", nc_strerror(RetVAL));
- nc_close(ncID);
- return -33;
- }
- RetVAL = nc_get_var_double(ncID, varID_C_G, C_G);
- if (RetVAL != NC_NOERR)
- {
- printf("Error reading C_G matrix: %s\n", nc_strerror(RetVAL));
- nc_close(ncID);
- return -33;
- }
- RetVAL = nc_get_var_double(ncID, varID_C_Gc, C_Gc);
- if (RetVAL != NC_NOERR)
- {
- printf("Error reading C_Gc matrix: %s\n", nc_strerror(RetVAL));
- nc_close(ncID);
- return -33;
- }
- RetVAL = nc_get_var_double(ncID, varID_X, X);
- if (RetVAL != NC_NOERR)
- {
- printf("Error reading X vector: %s\n", nc_strerror(RetVAL));
- nc_close(ncID);
- return -33;
- }
- RetVAL = nc_get_var_double(ncID, varID_Y, Y);
- if (RetVAL != NC_NOERR)
- {
- printf("Error reading Y vector: %s\n", nc_strerror(RetVAL));
- nc_close(ncID);
- return -33;
- }
- // Closing the file
- RetVAL = nc_close(ncID);
- if (RetVAL != NC_NOERR)
- {
- printf("Error closing file: %s\n", nc_strerror(RetVAL));
- return -38;
- }
- return 0;
- }
- int loadSolutionNetCDF(int ncID, int *varID_Vx, int *varID_Vy, int *varID_Phi, int *varID_C_RD, int *varID_C_RT, int *varID_C_G, int *varID_C_Gc)
- {
- // Function for loading NetCDF files for initial condition.
- // This function will return variable IDs and check if the needed initial condition matrices are included in the file.
- int RetVAL;
- RetVAL = nc_inq_varid(ncID, "VsX", varID_Vx);
- if (RetVAL != NC_NOERR)
- {
- printf("Error: Vx matrix not found in the file. %s\n", nc_strerror(RetVAL));
- return -31;
- }
- RetVAL = nc_inq_varid(ncID, "VsY", varID_Vy);
- if (RetVAL != NC_NOERR)
- {
- printf("Error: Vy matrix not found in the file. %s\n", nc_strerror(RetVAL));
- return -31;
- }
- RetVAL = nc_inq_varid(ncID, "Phi", varID_Phi);
- if (RetVAL != NC_NOERR)
- {
- printf("Error: Phi matrix not found in the file. %s\n", nc_strerror(RetVAL));
- return -31;
- }
- RetVAL = nc_inq_varid(ncID, "RD", varID_C_RD);
- if (RetVAL != NC_NOERR)
- {
- printf("Error: C_RD matrix not found in the file. %s\n", nc_strerror(RetVAL));
- return -31;
- }
- RetVAL = nc_inq_varid(ncID, "RT", varID_C_RT);
- if (RetVAL != NC_NOERR)
- {
- printf("Error: C_RT matrix not found in the file. %s\n", nc_strerror(RetVAL));
- return -31;
- }
- RetVAL = nc_inq_varid(ncID, "G", varID_C_G);
- if (RetVAL != NC_NOERR)
- {
- printf("Error: C_G matrix not found in the file. %s\n", nc_strerror(RetVAL));
- return -31;
- }
- RetVAL = nc_inq_varid(ncID, "Gc", varID_C_Gc);
- if (RetVAL != NC_NOERR)
- {
- printf("Error: C_Gc matrix not found in the file. %s\n", nc_strerror(RetVAL));
- return -31;
- }
- return 0;
- }
- int loadInitialConditionsFromSolution(const char *InitialConditionsFile, const char *SaveFileName, int SolutionIdx,
- size_t I, size_t J, double *X, double *Y,
- double *Vx, double *Vy, double *Phi, double *C_RD, double *C_RT, double *C_G, double *C_Gc, double *P,
- double *Time)
- {
- // Function for loading initial conditions for solution file.
- // In case the simulation was already run and terminated before finish.
- // Loading X and Y arrays
- int varID_Vx, varID_Vy, varID_Phi, varID_C_RD, varID_C_RT, varID_C_G, varID_C_Gc, varID_X, varID_Y;
- int ncID, RetVAL;
- // Retrieving initial conditions file ID
- ncID = readICNetCDF(InitialConditionsFile);
- if (ncID == -30) { return -30; }
- // Retrieving variable IDs from initial conditions file
- RetVAL = loadICNetCDF(ncID, &varID_Vx, &varID_Vy, &varID_Phi, &varID_C_RD, &varID_C_RT, &varID_C_G, &varID_C_Gc, &varID_X, &varID_Y);
- if (RetVAL != 0) { nc_close(ncID); return RetVAL;}
- RetVAL = nc_get_var_double(ncID, varID_X, X);
- if (RetVAL != NC_NOERR)
- {
- printf("Error reading X vector: %s\n", nc_strerror(RetVAL));
- nc_close(ncID);
- return -33;
- }
- RetVAL = nc_get_var_double(ncID, varID_Y, Y);
- if (RetVAL != NC_NOERR)
- {
- printf("Error reading Y vector: %s\n", nc_strerror(RetVAL));
- nc_close(ncID);
- return -33;
- }
- // Closing the file
- RetVAL = nc_close(ncID);
- if (RetVAL != NC_NOERR)
- {
- printf("Error closing Initial Conditions file: %s\n", nc_strerror(RetVAL));
- return -38;
- }
- // Clearing variables
- ncID, RetVAL = 0;
- varID_Vx, varID_Vy, varID_Phi, varID_C_RD, varID_C_RT, varID_C_G, varID_C_Gc = 0;
- int varID_Time, varID_P;
- // Loading initial conditions from Solution file.
- ncID = readICNetCDF(SaveFileName);
- // Retrieving variable IDs from Solution file.
- RetVAL = loadSolutionNetCDF(ncID, &varID_Vx, &varID_Vy, &varID_Phi, &varID_C_RD, &varID_C_RT, &varID_C_G, &varID_C_Gc);
- if (RetVAL != 0) { nc_close(ncID); return RetVAL;}
- // Open the solution file
- RetVAL = nc_open(SaveFileName, NC_NOWRITE, &ncID);
- if (RetVAL != NC_NOERR) {
- printf("Error opening solution file: %s\n", nc_strerror(RetVAL));
- return -30;
- }
- // Get variable IDs for required variables
- if ((RetVAL = nc_inq_varid(ncID, "VsX", &varID_Vx)) != NC_NOERR ||
- (RetVAL = nc_inq_varid(ncID, "VsY", &varID_Vy)) != NC_NOERR ||
- (RetVAL = nc_inq_varid(ncID, "Time", &varID_Time)) != NC_NOERR ||
- (RetVAL = nc_inq_varid(ncID, "Phi", &varID_Phi)) != NC_NOERR ||
- (RetVAL = nc_inq_varid(ncID, "RD", &varID_C_RD)) != NC_NOERR ||
- (RetVAL = nc_inq_varid(ncID, "RT", &varID_C_RT)) != NC_NOERR ||
- (RetVAL = nc_inq_varid(ncID, "G", &varID_C_G)) != NC_NOERR ||
- (RetVAL = nc_inq_varid(ncID, "Gc", &varID_C_Gc)) != NC_NOERR ||
- (RetVAL = nc_inq_varid(ncID, "P", &varID_P)) != NC_NOERR) {
- printf("Error: Required variable not found in file: %s\n", nc_strerror(RetVAL));
- nc_close(ncID);
- return -31;
- }
- // Define start and count for slicing data
- size_t start3D[3] = {SolutionIdx, 0, 0};
- size_t count3D_VsX[3] = {1, I - 1, J}; // For VsX
- size_t count3D_VsY[3] = {1, I, J - 1}; // For VsY
- size_t count3D[3] = {1, I, J}; // For 3D variables (Phi, RD, RT, G, Gc, P)
- size_t start1D[1] = {SolutionIdx};
- size_t count1D[1] = {1};
- // Read the variables
- if ((RetVAL = nc_get_vara_double(ncID, varID_Vx, start3D, count3D_VsX, Vx)) != NC_NOERR ||
- (RetVAL = nc_get_vara_double(ncID, varID_Vy, start3D, count3D_VsY, Vy)) != NC_NOERR ||
- (RetVAL = nc_get_vara_double(ncID, varID_Phi, start3D, count3D, Phi)) != NC_NOERR ||
- (RetVAL = nc_get_vara_double(ncID, varID_C_RD, start3D, count3D, C_RD)) != NC_NOERR ||
- (RetVAL = nc_get_vara_double(ncID, varID_C_RT, start3D, count3D, C_RT)) != NC_NOERR ||
- (RetVAL = nc_get_vara_double(ncID, varID_C_G, start3D, count3D, C_G)) != NC_NOERR ||
- (RetVAL = nc_get_vara_double(ncID, varID_C_Gc, start3D, count3D, C_Gc)) != NC_NOERR ||
- (RetVAL = nc_get_vara_double(ncID, varID_P, start3D, count3D, P)) != NC_NOERR) {
- printf("Error reading variable data: %s\n", nc_strerror(RetVAL));
- nc_close(ncID);
- return -33;
- }
- // Read the Time variable
- if ((RetVAL = nc_get_vara_double(ncID, varID_Time, start1D, count1D, Time)) != NC_NOERR) {
- printf("Error reading Time data: %s\n", nc_strerror(RetVAL));
- nc_close(ncID);
- return -33;
- }
- // Close the file
- if ((RetVAL = nc_close(ncID)) != NC_NOERR) {
- printf("Error closing file: %s\n", nc_strerror(RetVAL));
- return -38;
- }
- return 0;
- }
- int CreateSolutionsFile(const char *SaveFileName, size_t I, size_t J, int MaxTimeSteps)
- {
- // Function for creating solutions file.
- // Space needed is allocated before the start of simulation.
- // The empty matrix values are stored as biggest double value and not zero.
- int ncID, RetVAL;
- // Creating Solutions file
- int timeDimID, xDimID, yDimID, xDimVsXID, yDimVsYID, varID_Time, varID_VnsX, varID_VnsY, varID_VsX, varID_VsY, varID_VsX_1, varID_VsY_1, varID_Phi, varID_Phi_1, varID_RD, varID_RT, varID_G, varID_Gc, varID_P, varID_SimTime;
- RetVAL = nc_create(SaveFileName, NC_NETCDF4 | NC_CLOBBER, &ncID);
- if (RetVAL != NC_NOERR)
- {
- printf("Error creating file: %s\n", nc_strerror(RetVAL));
- return 34;
- }
- // Define dimensions
- RetVAL = nc_def_dim(ncID, "time", MaxTimeSteps, &timeDimID);
- if (RetVAL != NC_NOERR)
- {
- printf("Error defining time dimension: %s\n", nc_strerror(RetVAL));
- return 35;
- }
- RetVAL = nc_def_dim(ncID, "xDim", I, &xDimID);
- if (RetVAL != NC_NOERR)
- {
- printf("Error defining x dimension: %s\n", nc_strerror(RetVAL));
- return 35;
- }
- RetVAL = nc_def_dim(ncID, "yDim", J, &yDimID);
- if (RetVAL != NC_NOERR)
- {
- printf("Error defining y dimension: %s\n", nc_strerror(RetVAL));
- return 35;
- }
- // Define additional dimensions for VsX and VsY
- RetVAL = nc_def_dim(ncID, "xDimS", I - 1, &xDimVsXID);
- if (RetVAL != NC_NOERR)
- {
- printf("Error defining xDimS dimension: %s\n", nc_strerror(RetVAL));
- return 35;
- }
- RetVAL = nc_def_dim(ncID, "yDimS", J - 1, &yDimVsYID);
- if (RetVAL != NC_NOERR)
- {
- printf("Error defining yDimS dimension: %s\n", nc_strerror(RetVAL));
- return 35;
- }
- // Define variables
- int dims3D[3] = {timeDimID, xDimID, yDimID};
- int dimsTime[1] = {timeDimID};
- int dims2D[2] = {timeDimID, 1};
- // Time variable
- RetVAL = nc_def_var(ncID, "Time", NC_DOUBLE, 1, dimsTime, &varID_Time);
- if (RetVAL != NC_NOERR)
- {
- printf("Error defining Time variable: %s\n", nc_strerror(RetVAL));
- return 36;
- }
- // Simulation Time variable
- RetVAL = nc_def_var(ncID, "SimulationTime", NC_DOUBLE, 2, dims2D, &varID_SimTime);
- if (RetVAL != NC_NOERR)
- {
- printf("Error defining SimulationTime variable: %s\n", nc_strerror(RetVAL));
- return 36;
- }
- // Solution matrices
- RetVAL = nc_def_var(ncID, "VnsX", NC_DOUBLE, 3, dims3D, &varID_VnsX);
- if (RetVAL != NC_NOERR)
- {
- printf("Error defining VnsX variable: %s\n", nc_strerror(RetVAL));
- return 36;
- }
- RetVAL = nc_def_var(ncID, "VnsY", NC_DOUBLE, 3, dims3D, &varID_VnsY);
- if (RetVAL != NC_NOERR)
- {
- printf("Error defining VnsY variable: %s\n", nc_strerror(RetVAL));
- return 36;
- }
- // Redefine the dimensions for VsX (3D array with I-1 rows)
- dims3D[1] = xDimVsXID;
- RetVAL = nc_def_var(ncID, "VsX", NC_DOUBLE, 3, dims3D, &varID_VsX);
- if (RetVAL != NC_NOERR)
- {
- printf("Error defining VsX variable: %s\n", nc_strerror(RetVAL));
- return 36;
- }
- RetVAL = nc_def_var(ncID, "VsX_1", NC_DOUBLE, 3, dims3D, &varID_VsX_1);
- if (RetVAL != NC_NOERR)
- {
- printf("Error defining VsX_1 variable: %s\n", nc_strerror(RetVAL));
- return 36;
- }
- // Redefine the dimensions for VsY (3D array with J-1 columns)
- dims3D[1] = xDimID; // Reset to xDim for VsY
- dims3D[2] = yDimVsYID;
- RetVAL = nc_def_var(ncID, "VsY", NC_DOUBLE, 3, dims3D, &varID_VsY);
- if (RetVAL != NC_NOERR)
- {
- printf("Error defining VsY variable: %s\n", nc_strerror(RetVAL));
- return 36;
- }
- RetVAL = nc_def_var(ncID, "VsY_1", NC_DOUBLE, 3, dims3D, &varID_VsY_1);
- if (RetVAL != NC_NOERR)
- {
- printf("Error defining VsY_1 variable: %s\n", nc_strerror(RetVAL));
- return 36;
- }
- // Reset to original xDim and yDim for remaining matrices
- dims3D[1] = xDimID;
- dims3D[2] = yDimID;
- RetVAL = nc_def_var(ncID, "Phi", NC_DOUBLE, 3, dims3D, &varID_Phi);
- if (RetVAL != NC_NOERR)
- {
- printf("Error defining Phi variable: %s\n", nc_strerror(RetVAL));
- return 36;
- }
- RetVAL = nc_def_var(ncID, "Phi_1", NC_DOUBLE, 3, dims3D, &varID_Phi_1);
- if (RetVAL != NC_NOERR)
- {
- printf("Error defining Phi_1 variable: %s\n", nc_strerror(RetVAL));
- return 36;
- }
- RetVAL = nc_def_var(ncID, "RD", NC_DOUBLE, 3, dims3D, &varID_RD);
- if (RetVAL != NC_NOERR)
- {
- printf("Error defining RD variable: %s\n", nc_strerror(RetVAL));
- return 36;
- }
- RetVAL = nc_def_var(ncID, "RT", NC_DOUBLE, 3, dims3D, &varID_RT);
- if (RetVAL != NC_NOERR)
- {
- printf("Error defining RT variable: %s\n", nc_strerror(RetVAL));
- return 36;
- }
- RetVAL = nc_def_var(ncID, "G", NC_DOUBLE, 3, dims3D, &varID_G);
- if (RetVAL != NC_NOERR)
- {
- printf("Error defining G variable: %s\n", nc_strerror(RetVAL));
- return 36;
- }
- RetVAL = nc_def_var(ncID, "Gc", NC_DOUBLE, 3, dims3D, &varID_Gc);
- if (RetVAL != NC_NOERR)
- {
- printf("Error defining Gc variable: %s\n", nc_strerror(RetVAL));
- return 36;
- }
- RetVAL = nc_def_var(ncID, "P", NC_DOUBLE, 3, dims3D, &varID_P);
- if (RetVAL != NC_NOERR)
- {
- printf("Error defining P variable: %s\n", nc_strerror(RetVAL));
- return 36;
- }
- // End definitions and leave define mode
- RetVAL = nc_enddef(ncID);
- if (RetVAL != NC_NOERR)
- {
- printf("Error leaving define mode: %s\n", nc_strerror(RetVAL));
- return 37;
- }
- // Close the file (it will be reopened for writing during the simulation)
- RetVAL = nc_close(ncID);
- if (RetVAL != NC_NOERR)
- {
- printf("Error closing file: %s\n", nc_strerror(RetVAL));
- return 38;
- }
- return 0;
- }
- void GenerateTracerPosition(int Cluster, int Seed, int NumPoints, double Rmin, double Rmax, double DomainLength, double *VecX, double *VecY)
- {
- // Function for generating initial positions of Tracers.
- // Rmin and Rmax parameters define the minimum and maximum radius the point can have with respect to the domain center.
- double x,y,r,phi;
- // The seed is defined in Parameters file.
- srand(Seed);
- for (int i = 0; i < NumPoints; i++)
- {
- double u = (double)rand() / RAND_MAX;
- // the radius is proportional to sqrt(u) so that we get homogeneous distribution in x and y dimensions.
- r = (Rmax - Rmin) * sqrt(u) + Rmin;
- phi = 2 * M_PI * ((double)rand() / RAND_MAX);
- x = DomainLength/2 + r * cos(phi);
- y = DomainLength/2 + r * sin(phi);
- if(Cluster==0 || NumPoints != 0)
- {
- printf("x:%lf\ty:%lf\n",x,y);
- }
- VecX[i]=x;
- VecY[i]=y;
- }
- }
- int CrateTracerFiles(char *TracerFolder, int TracerNBulk, int TracerNOut,
- double *TracerPositionBx, double *TracerPositionBy, double *TracerPositionOx, double *TracerPositionOy,
- char TracersBulkFileNames[][100], char TracersOutFileNames[][100])
- {
- // Function for creating binary files tracer positions will be stored in.
- double time_stamp = 0.0;
- // Bulk Tracer Files
- for (int i = 0; i < TracerNBulk; i++)
- {
- snprintf(TracersBulkFileNames[i], 100, "%sBulkTracer_%d.bin", TracerFolder, i+1);
- FILE *file = fopen(TracersBulkFileNames[i], "wb");
- if (!file)
- {
- printf("Error opening file");
- return 40;
- }
- fwrite(&time_stamp, sizeof(double), 1, file); // This is time stamp equal to 0 for initial position.
- fwrite(&TracerPositionBx[i], sizeof(double), 1, file);
- fwrite(&TracerPositionBy[i], sizeof(double), 1, file);
- fclose(file);
- }
- // Tracers Out Files
- for (int i = 0; i < TracerNOut; i++)
- {
- snprintf(TracersOutFileNames[i], 100, "%sOutTracer_%d.bin", TracerFolder, i+1);
- FILE *file = fopen(TracersOutFileNames[i], "wb");
- if (!file)
- {
- printf("Error opening file");
- return 40;
- }
- fwrite(&time_stamp, sizeof(double), 1, file);
- fwrite(&TracerPositionOx[i], sizeof(double), 1, file);
- fwrite(&TracerPositionOy[i], sizeof(double), 1, file);
- fclose(file);
- }
- return 0;
- }
- void printParameters(const char *InitialConditionsFile, const char *SaveFileName,
- int nTracersB, int nTracersO,
- int NumberOfSaveCycles, int NumberOfDoubleStep, int MaxIter,
- size_t I, size_t J,
- double dx, double dy, double dt, double CO, double vBB, double vBS,
- double PTol, double eps, double nu, double cG, double Si0, double kSi, double kC, double Beta, double Alpha,
- double DRD, double DRT, double DG, double DGc, double k1, double k2, double k3, double k11, double k12, double R_Max)
- {
- // Function for displaying loaded Parameters
- printf("Original Initial conditions File is: '%s'.\n", InitialConditionsFile);
- printf("File for saving data with the name: '%s', will be created.\n\n", SaveFileName);
- printf("Solution Matrices will be saved every: %d steps, which is equivalent to saving every %2.3lf s.\n\n", 2*NumberOfDoubleStep, 2*NumberOfDoubleStep*dt);
- printf("Domain is split onto: %zu Points in x and %zu Points in y direction,\n", I, J);
- printf("With Grid spacing of: %1.3lf in x and %1.3lf in y direction,\n", dx, dy);
- printf("Which gives: %2.3lf by %2.3lf Domain.\n\n", dx*(I-1), dy*(J-1));
- printf("Time Step length is: %lf.\n\n", dt);
- printf("Gradient CutOff is: %1.1e, while Potential Saturation values are: %2.1lf for Bulk and %2.1lf for Surface.\n\n", CO, vBB, vBS);
- printf("Pressure Tolerance at which iterative process is stopped: %1.1e.\n\n", PTol);
- printf("Viscosity of the fluid is: %2.3lf, while dissipation coefficient is %2.3lf.\n\n", nu, Beta);
- printf("Level-Set Parameters are:\n \t Epsilon: %2.3lf,\n \t Gamma: %2.3lf. \n \t Alpha: %2.3lf.\n\n", eps, cG, Alpha);
- printf("Parameters for Force on the membrane:\n \t Surface tension Sigma: %2.3lf,\n \t Surface tension change rate: %2.3lf,\n \t Force from interaction with the substrate coefficient: %2.3lf.\n\n", Si0, kSi, kC);
- printf("Diffusion constants are:\n \t D_RD: %2.3lf,\n \t D_RT: %2.3lf,\n \t D_G: %2.3lf,\n \t D_Gc: %2.3lf.\n\n", DRD, DRT, DG, DGc);
- printf("Reaction constants are:\n \t k1: %2.3lf,\n \t k2: %2.3lf,\n \t k3: %2.3lf,\n \t k11: %2.3lf,\n \t k12: %2.3lf.\n", k1, k2, k3, k11, k12);
- printf("Concentration of binding spaces for Rac1T is: %3.1lf\n\n", R_Max);
- printf("Number of tracers inside cell: %d\n", nTracersB);
- printf("Number of tracers outside cell: %d\n\n", nTracersO);
- }
- // Error codes
- // 10 - Failed to load or parse the JSON file. (Check input file names and LoadJSON function)
- // 11 - Failed to find key in .json file
- // 12 - Array size in .json file is missing values or has extra values.
- // 20 - Cluster variable not set properly. Can't determine if the simulation is to be run on cluster without inputs or on personal computer with input and print options.
- // 30 - Failed to open .nc file
- // 31 - Variable not found in .nc file
- // 32 - Failed to get the dimension of variable
- // 33 - Failed to read the variable
- // 34 - Failed to create .nc file
- // 35 - Failed to define dimensions in .nc file
- // 36 - Failed to define variable in .nc file
- // 37 - Failed to exit variable definition mode
- // 38 - Failed to close .nc file
- // 40 - Failed to open Tracer files
- // 95 - Simulation aborted by the user
- // 96 - Error occurred during simulation.
- // 97 - Initial Conditions File and Parameters File dimensions are not compatible
- // 98 - Memory allocation failed.
- // 99 - The y/n question input is neither "y" nor "n"
- int main(int argc, char *argv[])
- {
- // Main function for simulating cell locomotion
- // Error code
- int ERROR;
- // y/n input
- char InputYN[3];
- // Simulation Parameters allocation
- char ParametersFile[100];
- // File
- char InitialConditionsFile[100], SaveFileName[100], TracerFolder[100], TracerPrefix[100];
- // Simulation
- int Seed, Cluster, nTracersB, nTracersO, NumberOfSaveCycles, NumberOfDoubleStep, MaxIter;
- size_t I, J;
- double dx, dy, dt, CO, vBB, vBS, PTol;
- // Model
- double eps, nu, cG, Si0, kSi, kC, Beta, Alpha;
- double DRD, DRT, DG, DGc;
- double k1, k2, k3, k11, k12;
- double R_Max;
- // Loading Parameters from .json file
- if (argc>=3) // If Parameters file and initial conditions file were provided
- {
- // Copying provided file names
- strcpy(ParametersFile, argv[1]);
- strcpy(InitialConditionsFile, argv[2]);
- // Loading parameters file
- cJSON *JSONFile = loadJSON(ParametersFile);
- if (!JSONFile)
- {
- printf("Error: Failed to load or parse the JSON file\n");
- cJSON_Delete(JSONFile); // Clean up cJSON object
- return 10;
- }
- // Loading parameters form .json
- ERROR = loadParameters(JSONFile,
- InitialConditionsFile, SaveFileName, TracerFolder, TracerPrefix,
- &Seed, &Cluster, &nTracersB, &nTracersO, &NumberOfSaveCycles, &NumberOfDoubleStep,
- &I, &J,
- &dx, &dy, &dt, &CO, &vBB, &vBS, &MaxIter, &PTol,
- &eps, &nu, &cG, &Si0, &kSi, &kC, &Beta, &Alpha,
- &DRD, &DRT, &DG, &DGc,
- &k1, &k2, &k3, &k11, &k12, &R_Max);
- if (ERROR != 0)
- {
- printf("Error: Failed to save parameter values from the JSON file\n");
- cJSON_Delete(JSONFile); // Clean up cJSON object
- return ERROR;
- }
- cJSON_Delete(JSONFile); // Clean up cJSON object
- }
- else // If Parameters file and initial conditions file were both NOT provided
- {
- // Declaration of variables
- char InitialConditionsFileInput[100];
- // Starting simulation preparation
- printf("Cell Locomotion Simulation\n\n");
- // Asking to provide the parameters file name
- printf("Please enter the Parameters File Name: ");
- fgets(ParametersFile, sizeof(ParametersFile), stdin);
- ParametersFile[strcspn(ParametersFile, "\n")] = 0;
- // Loading parameters file
- cJSON *JSONFile = loadJSON(ParametersFile);
- if (!JSONFile)
- {
- printf("Error: Failed to load or parse the JSON file\n");
- cJSON_Delete(JSONFile); // Clean up cJSON object
- return 10;
- }
- // Loading parameters form .json
- ERROR = loadParameters(JSONFile,
- InitialConditionsFile, SaveFileName, TracerFolder, TracerPrefix,
- &Seed, &Cluster, &nTracersB, &nTracersO, &NumberOfSaveCycles, &NumberOfDoubleStep,
- &I, &J,
- &dx, &dy, &dt, &CO, &vBB, &vBS, &MaxIter, &PTol,
- &eps, &nu, &cG, &Si0, &kSi, &kC, &Beta, &Alpha,
- &DRD, &DRT, &DG, &DGc,
- &k1, &k2, &k3, &k11, &k12, &R_Max);
- if (ERROR != 0)
- {
- printf("Error: Failed to load parameter values from the JSON file\n");
- cJSON_Delete(JSONFile); // Clean up cJSON object
- return ERROR;
- }
- cJSON_Delete(JSONFile); // Clean up cJSON object
- // Asking to provide the initial conditions file name
- printf("Do you want to use original Initial Conditions from Parameters File?: (y/n) \n");
- fgets(InputYN, sizeof(InputYN), stdin);
- InputYN[strcspn(InputYN, "\n")] = 0;
- if(strcmp(InputYN,"n")==0)
- {
- // Asking to provide the initial conditions file name
- printf("\nPlease provide the new Initial Conditions file in the same folder as the program before continuing!");
- printf("\nPlease enter the Initial Conditions File Name: \n");
- fgets(InitialConditionsFileInput, sizeof(InitialConditionsFileInput), stdin);
- InitialConditionsFileInput[strcspn(InitialConditionsFileInput, "\n")] = 0;
- // Copying initial conditions file name
- for(size_t i=0; i<100; i++)
- {
- InitialConditionsFile[i]=InitialConditionsFileInput[i];
- }
- }
- else if(strcmp(InputYN,"y")==0)
- {
- // Initial conditions file name was loaded from parameters file and not overwritten
- printf("\nOriginal Initial Conditions will be loaded\n");
- }
- else
- {
- printf("\nError: Please enter y for YES and n for NO.\n");
- return 99;
- }
- }
- // Memory allocation for initial conditions arrays
- ALLOC_ARRAY(Vx,double,I-1,J);
- ALLOC_ARRAY(Vy,double,I,J-1);
- ALLOC_ARRAY(Phi,double,I,J);
- ALLOC_ARRAY(C_RD,double,I,J);
- ALLOC_ARRAY(C_RT,double,I,J);
- ALLOC_ARRAY(C_G,double,I,J);
- ALLOC_ARRAY(C_Gc,double,I,J);
- ALLOC_ARRAY(X,double,I,1);
- ALLOC_ARRAY(Y,double,1,J);
- ALLOC_ARRAY(P,double,I,J);
- if (Vx == NULL) {printf("Error: Memory allocation failed for Vx\n"); return 98;}
- if (Vy == NULL) {printf("Error: Memory allocation failed for Vy\n"); return 98;}
- if (Phi == NULL) {printf("Error: Memory allocation failed for Phi\n"); return 98;}
- if (C_RD == NULL) {printf("Error: Memory allocation failed for C_RD\n"); return 98;}
- if (C_RT == NULL) {printf("Error: Memory allocation failed for C_RT\n"); return 98;}
- if (C_G == NULL) {printf("Error: Memory allocation failed for C_G\n"); return 98;}
- if (C_Gc == NULL) {printf("Error: Memory allocation failed for C_Gc\n"); return 98;}
- if (X == NULL) {printf("Error: Memory allocation failed for X\n"); return 98;}
- if (Y == NULL) {printf("Error: Memory allocation failed for Y\n"); return 98;}
- if (P == NULL) {printf("Error: Memory allocation failed for P\n"); return 98;}
- double Time = 0;
- // Returning error value for loading initial conditions
- int RetVAL;
- // Memory allocation for tracers
- double TracerPositionBx[nTracersB];
- double TracerPositionBy[nTracersB];
- double TracerPositionOx[nTracersO];
- double TracerPositionOy[nTracersO];
- char TracersBulkFileNames[nTracersB][100];
- char TracersOutFileNames[nTracersO][100];
- // Memory allocation for pressuer iteration number array
- ALLOC_ARRAY(nIterStepVec, int, NumberOfSaveCycles*NumberOfDoubleStep*2+1, 1);
- // Initiating something
- double SimulationTime = 0;
- double PrctSave=2;
- // Forking for cluster or personal computer simulation setup
- if(Cluster==1)
- {
- // Checking if the solution file already exists which signals the simulation has been terminated before
- int SolutionIdx = checkSolutionFile(SaveFileName);
- if (SolutionIdx < -1)
- {
- printf("Error: Failed to access Solutions file!\n");
- if (Vx) free(Vx);
- if (Vy) free(Vy);
- if (Phi) free(Phi);
- if (C_RD) free(C_RD);
- if (C_RT) free(C_RT);
- if (C_G) free(C_G);
- if (C_Gc) free(C_Gc);
- if (X) free(X);
- if (Y) free(Y);
- if (P) free(P);
- if (nIterStepVec) free(nIterStepVec);
- return -SolutionIdx;
- }
- else if (SolutionIdx == -1)
- {
- // Solution file does not exist
- RetVAL = loadInitialConditions(InitialConditionsFile,I,J,Vx,Vy,Phi,C_RD,C_RT,C_G,C_Gc,X,Y);
- if (RetVAL < 0)
- {
- return -RetVAL;
- }
- CreateSolutionsFile(SaveFileName,I,J,NumberOfSaveCycles+1);
- }
- else
- {
- // Solution file exists
- loadInitialConditionsFromSolution(InitialConditionsFile,SaveFileName,SolutionIdx,
- I,J,X,Y,
- Vx,Vy,Phi,C_RD,C_RT,C_G,C_Gc,P,
- &Time);
- }
- GenerateTracerPosition(Cluster,Seed,nTracersB,0,6.21,X[I-1],TracerPositionBx,TracerPositionBy);
- GenerateTracerPosition(Cluster,Seed,nTracersO,6.5,11.2,X[I-1],TracerPositionOx,TracerPositionOy);
- RetVAL = CrateTracerFiles(TracerPrefix,nTracersB,nTracersO,TracerPositionBx,TracerPositionBy,TracerPositionOx,TracerPositionOy,TracersBulkFileNames,TracersOutFileNames);
- if (RetVAL != 0)
- {
- printf("Error: Failed to create Tracer files!\n");
- if (Vx) free(Vx);
- if (Vy) free(Vy);
- if (Phi) free(Phi);
- if (C_RD) free(C_RD);
- if (C_RT) free(C_RT);
- if (C_G) free(C_G);
- if (C_Gc) free(C_Gc);
- if (X) free(X);
- if (Y) free(Y);
- if (P) free(P);
- if (nIterStepVec) free(nIterStepVec);
- return RetVAL;
- }
- SimulationTime = simulation(SolutionIdx,Time,Cluster,SaveFileName,NumberOfSaveCycles,NumberOfDoubleStep,PrctSave,
- nTracersB,nTracersO,TracerPositionBx,TracerPositionBy,TracerPositionOx,TracerPositionOy,TracersBulkFileNames,TracersOutFileNames,
- I,J,dx,dy,dt,eps,nu,cG,
- CO,vBB,vBS,MaxIter,PTol,nIterStepVec,
- Si0,kSi,kC,Beta,Alpha,
- DRD,DRT,DG,DGc,k1,k2,k3,k11,k12,R_Max,
- P,Vx,Vy,Phi,C_RT,C_RD,C_G,C_Gc,X,Y);
- if(SimulationTime==-1)
- {
- printf("Error occurred closing tracer files.\n");
- if (Vx) free(Vx);
- if (Vy) free(Vy);
- if (Phi) free(Phi);
- if (C_RD) free(C_RD);
- if (C_RT) free(C_RT);
- if (C_G) free(C_G);
- if (C_Gc) free(C_Gc);
- if (X) free(X);
- if (Y) free(Y);
- if (nIterStepVec) free(nIterStepVec);
- return 96;
- }
- }
- else if(Cluster==0)
- {
- printf("Parameters file loaded!\n\n");
- printParameters(InitialConditionsFile,SaveFileName,
- nTracersB,nTracersO,
- NumberOfSaveCycles,NumberOfDoubleStep,MaxIter,
- I, J,
- dx,dy,dt,CO,vBB,vBS,
- PTol,eps,nu,cG,Si0,kSi,kC,Beta, Alpha,
- DRD,DRT,DG,DGc,
- k1,k2,k3,k11,k12,R_Max);
- printf("Checking existence of Solutions file!\n");
- int SolutionIdx = checkSolutionFile(SaveFileName);
- if (SolutionIdx < -1)
- {
- printf("Error: Failed to access Solutions file!\n");
- if (Vx) free(Vx);
- if (Vy) free(Vy);
- if (Phi) free(Phi);
- if (C_RD) free(C_RD);
- if (C_RT) free(C_RT);
- if (C_G) free(C_G);
- if (C_Gc) free(C_Gc);
- if (X) free(X);
- if (Y) free(Y);
- if (P) free(P);
- if (nIterStepVec) free(nIterStepVec);
- return -SolutionIdx;
- }
- else if (SolutionIdx == -1)
- {
- // Solution file does not exist
- printf("Solution file does not exist!\n");
- printf("Initial conditions will be loaded from Initial Conditions file!\n");
- RetVAL = loadInitialConditions(InitialConditionsFile,I,J,Vx,Vy,Phi,C_RD,C_RT,C_G,C_Gc,X,Y);
- if (RetVAL < 0)
- {
- return -RetVAL;
- }
- printf("Solutions file will be created\n");
- CreateSolutionsFile(SaveFileName,I,J,NumberOfSaveCycles+1);
- }
- else
- {
- // Solution file exists
- printf("Solution file exists!\n");
- printf("Would you like to load initial conditions from Solutions File and continue the simulation?: (y/n) \n");
- fgets(InputYN, sizeof(InputYN), stdin);
- InputYN[strcspn(InputYN, "\n")] = 0;
- if(strcmp(InputYN,"n")==0)
- {
- printf("Initial conditions will be loaded from Initial Conditions file!\n");
- RetVAL = loadInitialConditions(InitialConditionsFile,I,J,Vx,Vy,Phi,C_RD,C_RT,C_G,C_Gc,X,Y);
- if (RetVAL < 0)
- {
- return -RetVAL;
- }
- printf("Solutions file will be created\n");
- CreateSolutionsFile(SaveFileName,I,J,NumberOfSaveCycles+1);
- }
- else if(strcmp(InputYN,"y")==0)
- {
- printf("Initial conditions will be loaded from Solutions file!\n");
- printf("Solution index is = %d\n",SolutionIdx);
- loadInitialConditionsFromSolution(InitialConditionsFile,SaveFileName,SolutionIdx,
- I,J,X,Y,
- Vx,Vy,Phi,C_RD,C_RT,C_G,C_Gc,P,
- &Time);
- }
- else
- {
- printf("\nError: Please enter y for YES and n for NO.\n");
- return 99;
- }
- }
- if (nTracersB != 0) {printf("Tracer Positions in the Bulk:\n");}
- GenerateTracerPosition(Cluster,Seed,nTracersB,0,6.21,X[I-1],TracerPositionBx,TracerPositionBy);
- if (nTracersO != 0) {printf("Tracer Positions Outside the cell:\n");}
- GenerateTracerPosition(Cluster,Seed,nTracersO,6.5,11.2,X[I-1],TracerPositionOx,TracerPositionOy);
- if (nTracersO != 0 || nTracersB != 0) {printf("\nTracer Files will be created in: %s\n",TracerFolder);}
- CrateTracerFiles(TracerFolder,nTracersB,nTracersO,TracerPositionBx,TracerPositionBy,TracerPositionOx,TracerPositionOy,TracersBulkFileNames,TracersOutFileNames);
- printf("\n\nStart simulation? ((y/n))\n");
- fgets(InputYN, sizeof(InputYN), stdin);
- InputYN[strcspn(InputYN, "\n")] = 0;
- if(strcmp(InputYN,"n")==0)
- {
- printf("Simulation aborted...\n");
- if (Vx) free(Vx);
- if (Vy) free(Vy);
- if (Phi) free(Phi);
- if (C_RD) free(C_RD);
- if (C_RT) free(C_RT);
- if (C_G) free(C_G);
- if (C_Gc) free(C_Gc);
- if (X) free(X);
- if (Y) free(Y);
- if (P) free(P);
- if (nIterStepVec) free(nIterStepVec);
- return 95;
- }
- else if(strcmp(InputYN,"y")==0)
- {
- SimulationTime = simulation(SolutionIdx,Time,Cluster,SaveFileName,NumberOfSaveCycles,NumberOfDoubleStep,PrctSave,
- nTracersB,nTracersO,TracerPositionBx,TracerPositionBy,TracerPositionOx,TracerPositionOy,TracersBulkFileNames,TracersOutFileNames,
- I,J,dx,dy,dt,eps,nu,cG,
- CO,vBB,vBS,MaxIter,PTol,nIterStepVec,
- Si0,kSi,kC,Beta,Alpha,
- DRD,DRT,DG,DGc,k1,k2,k3,k11,k12,R_Max,
- P,Vx,Vy,Phi,C_RT,C_RD,C_G,C_Gc,X,Y);
- if(SimulationTime==-1)
- {
- printf("Error occurred closing tracer files.\n");
- if (Vx) free(Vx);
- if (Vy) free(Vy);
- if (Phi) free(Phi);
- if (C_RD) free(C_RD);
- if (C_RT) free(C_RT);
- if (C_G) free(C_G);
- if (C_Gc) free(C_Gc);
- if (X) free(X);
- if (Y) free(Y);
- if (P) free(P);
- if (nIterStepVec) free(nIterStepVec);
- return 96;
- }
- printf("Simulation took %lf s.", SimulationTime);
- char ch;
- scanf(" %c", &ch); // Not to close the window. When running on Windows from cmd.
- }
- else
- {
- printf("\nError: Please enter y for YES and n for NO.\n");
- return 99;
- }
- }
- else
- {
- printf("\nError: Value of \"Cluster\" variable neither 0 nor 1. Please check the parameters file!\n");
- return 20;
- }
- if (Vx) free(Vx);
- if (Vy) free(Vy);
- if (Phi) free(Phi);
- if (C_RD) free(C_RD);
- if (C_RT) free(C_RT);
- if (C_G) free(C_G);
- if (C_Gc) free(C_Gc);
- if (X) free(X);
- if (Y) free(Y);
- if (P) free(P);
- if (nIterStepVec) free(nIterStepVec);
- return 0;
- }
main.c at commit c76d59f, under MIT · at the source
Overview
- Division of Physical Chemistry, Ruđer Bošković Institute, Zagreb, Croatia
- Centre for Advanced Laser Techniques, Institute of Physics, Zagreb, Croatia
- Division of Molecular Biology, Ruđer Bošković Institute, Zagreb, Croatia
- Department of Physics, Faculty of Sciences, Friedrich-Alexander-Universität, Erlangen, Bavaria, Germany
- Competence Center Engineering of Advanced Materials, Friedrich-Alexander-Universität, Erlangen, Bavaria, Germany
Abstract
Cell migration is a fundamental process underlying the survival and function of both unicellular and multicellular organisms. Crawling motility in eukaryotic cells arises from cyclic protrusion and retraction driven by the cytoskeleton, whose organization is regulated by reaction–diffusion (RD) dynamics of Rho GTPases between the cytosol and the cortex. These dynamics generate spatial membrane patterning and establish front–rear polarity through the coupling of biochemical signalling and mechanical feedback. We develop a cross-scale mean-field framework that integrates RD signalling with cytosolic and cortical hydrodynamics to capture the evolution of cell shapes and emergent cellular locomotion. Our model reproduces diverse experimentally observed shape and motility phenotypes with small parameter changes, indicating that these behaviours correspond to self-organized limit cycles. Phase-space analysis reveals that coupling to both cytosolic flow and spatially varying surface tension is essential to recover the full spectrum of motility modes, providing a theoretical foundation for understanding amoeboid migration.
Reproduced under the paper's license (CC BY), from the paper cited above.
Repositories
Its files are read in the Code ↔ Paper reader above.
blejzara/CellRDA-LS
c76d59f3ca568c1f6dedfc59c38473e5571f0987, 30 October 2025Availability: 1 check, the latest on 30 September 2026: the link answers
- 30 September 2026: the link answers
7 files
- src/
main.c , C, 1,327 lines - src/
simulation.c , C, 1,676 lines - src/
simulation.h , C/C++, 34 lines - third_party/
cJSON/ , C, 750 linescJSON.c - third_party/
cJSON/ , C/C++, 149 linescJSON.h - LICENSE, License, 21 lines
- README.MD, Text, 180 lines
Zenodo 18824137
Availability: 1 check, the latest on 30 September 2026: the link answers (HTTP 200)
- 30 September 2026: the link answers (HTTP 200)
1 file
- README.md, Text, 40 lines
The paper's code and data availability statement is in the Data section.
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 2 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 5 scripts, each with its path and the digest of its content;
- no match between paragraphs and code yet;
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
No dataset and no data link were found in the paper.
Data Availability
All data used to produce the figures presented in this manuscript are available at: DOI:10.5281/
Reproduced under the paper's license (CC BY), from the paper cited above.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 1, 30 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 5 authors, 11 MeSH terms, 2 funders, 118 references.
Cite
This paper
Ivšić, B., Vulić, D., Weber, I., Nowakowski, P., & Smith, A.-S. (2026). Diversity in emergent cell locomotion from the coupling cytosolic and cortical Marangoni flows with reaction-diffusion dynamics. PLoS computational biology, 22(4), e1014216. https://
BibTeX
@article{ivsic2026divers
author = {Ivšić, Blaž and Vulić, Dorijan and Weber, Igor and Nowakowski, Piotr and Smith, Ana-Sunčana},
title = {{Diversity in emergent cell locomotion from the coupling cytosolic and cortical Marangoni flows with reaction-diffusion dynamics}},
journal = {PLoS computational biology},
year = {2026},
month = apr,
volume = {22},
number = {4},
pages = {e1014216},
publisher = {PLOS},
issn = {1553-734X},
doi = {10.1371/
url = {https://
pmid = {42044154},
pmcid = {PMC13148778}
}
RIS
TY - JOUR
AU - Ivšić, Blaž
AU - Vulić, Dorijan
AU - Weber, Igor
AU - Nowakowski, Piotr
AU - Smith, Ana-Sunčana
TI - Diversity in emergent cell locomotion from the coupling cytosolic and cortical Marangoni flows with reaction-diffusion dynamics
T2 - PLoS computational biology
J2 - PLoS Comput Biol
PY - 2026
DA - 2026/
VL - 22
IS - 4
SP - e1014216
SN - 1553-734X
PB - PLOS
DO - 10.1371/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1371/
"type": "article-journal",
"title": "Diversity in emergent cell locomotion from the coupling cytosolic and cortical Marangoni flows with reaction-diffusion dynamics",
"container-title": "PLoS computational biology",
"author": [
{
"family": "Ivšić",
"given": "Blaž"
},
{
"family": "Vulić",
"given": "Dorijan"
},
{
"family": "Weber",
"given": "Igor"
},
{
"family": "Nowakowski",
"given": "Piotr"
},
{
"family": "Smith",
"given": "Ana-Sunčana"
}
],
"container-title-short":
"volume": "22",
"issue": "4",
"page": "e1014216",
"DOI": "10.1371/
"PMID": "42044154",
"PMCID": "PMC13148778",
"ISSN": "1553-734X",
"publisher": "PLOS",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
4,
27
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.1038/s41556-026-01965-1 [code]
- Long-range mutual activation establishes Rho and Rac polarity during cell migration.Journal: Nature cell biologyIn common: cellular / molecular, 5 references
- [2] doi:10.1038/s41467-026-72845-3 [code]
- The membrane-to-cortex distance regulates mDia1 activity to control cortical mechanics.Journal: Nature communicationsIn common: cellular / molecular, 4 references
- [3] doi:10.1126/sciadv.aec7705 [code]
- Mitotic Cdc42 waves encode PI(3,4)P&
lt;sub& gt;2& lt;/ sub& gt; signaling and Golgi morphological state to control spindle scaling. Journal: Science advancesIn common: cellular / molecular, 4 references - [4] doi:10.1002/advs.77115
- RNA Promotes Synapsin Condensates That Organize Synaptic Vesicles in Live Neurons and Enable Localized Translation in Reconstituted System.Journal: Advanced science (Weinheim, Baden-Wurttemberg, Germany)In common: cellular / molecular, 2 references
- [5] doi:10.1186/s12860-026-00584-w
- A role for PaxB in regulating blebbing: experimental insights and theoretical perspectives from Dictyostelium discoideum.Journal: BMC molecular and cell biologyIn common: none (in silico), 1 reference
- [6] doi:10.1126/sciadv.aeb3209 [code]
- The actomyosin cortex controls t-tubule remodeling in skeletal muscle.Journal: Science advancesIn common: cellular / molecular, 2 references
- [7] doi:10.1085/jgp.202513926
- Characterization of an open-channel structure and lateral conduction pathway in the cation-selective pentameric ligand-gated ion channel, ELIC.Journal: The Journal of general physiologyIn common: none (in silico), computational modeling (no new data), cellular / molecular
- [8] doi:10.1016/j.celrep.2026.117793 [code]
- Clustered inputs engage dendritic nonlinearities and calcium signaling to support efficient place-field formation in CA1 pyramidal neurons.Journal: Cell reportsIn common: none (in silico), computational modeling (no new data), cellular / molecular
- [9] doi:10.1038/s41586-026-10670-w [code]
- Zero-shot design of drug-binding proteins via neural iterative selection-expansion.Journal: NatureIn common: none (in silico), computational modeling (no new data), cellular / molecular
- [10] doi:10.1038/s41598-026-55218-0
- Amorphous metal-oxide semiconductor thin-film neuron, synapse, and neuromorphic system.Journal: Scientific reportsIn common: none (in silico), computational modeling (no new data), cellular / molecular
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 2 repositories of the authors' code, each at its verified commit and with its license, 5 scripts, and 0 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:df2370193acb77e2…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[, paste the snippet at the top, then “Commit changes…” and, to review it first, “Create a new branch and start a pull request”. You open the pull request; OSCR asks for no permission.
Request its removal
To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).
Discussion, reproductions, activity
Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.
Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
