<commit_before>/*******************************************************************************
GPU OPTIMIZED MONTE CARLO (GOMC) 2.70
Copyright (C) 2018  GOMC Group
A copy of the GNU General Public License can be found in the COPYRIGHT.txt
along with this program, also can be found at <http://www.gnu.org/licenses/>.
********************************************************************************/
#ifdef GOMC_CUDA
#include <cuda.h>
#include <cuda_runtime.h>
#include "GeomLib.h"
#include "ConstantDefinitionsCUDAKernel.cuh"
#include "CUDAMemoryManager.cuh"
#include <iostream>
#include <stdio.h>

void UpdateGPULambda(VariablesCUDA *vars, int *molIndex, double *lambdaVDW,
                    double *lambdaCoulomb, bool *isFraction)
{
  // copy lambda data
  cudaMemcpy(vars->gpu_molIndex, molIndex, BOX_TOTAL * sizeof(int),
             cudaMemcpyHostToDevice);
  cudaMemcpy(vars->gpu_lambdaVDW, lambdaVDW, BOX_TOTAL * sizeof(double),
             cudaMemcpyHostToDevice);
  cudaMemcpy(vars->gpu_lambdaCoulomb, lambdaCoulomb, BOX_TOTAL * sizeof(double),
             cudaMemcpyHostToDevice);
  cudaMemcpy(vars->gpu_isFraction, isFraction, BOX_TOTAL * sizeof(bool),
             cudaMemcpyHostToDevice);
}

void InitGPUForceField(VariablesCUDA &vars, double const *sigmaSq,
                       double const *epsilon_Cn,
                       double const *n, int VDW_Kind, int isMartini,
                       int count, double Rcut, double const *rCutCoulomb,
                       double RcutLow, double Ron, double const *alpha,
                       int ewald, double diElectric_1)
{
  int countSq = count * count;
  CUMALLOC((void**) &vars.gpu_sigmaSq, countSq * sizeof(double));
    checkLastErrorCUDA(__FILE__, __LINE__);

  CUMALLOC((void**) &vars.gpu_epsilon_Cn, countSq * sizeof(double));
    checkLastErrorCUDA(__FILE__, __LINE__);

  CUMALLOC((void**) &vars.gpu_n, countSq * sizeof(double));
    checkLastErrorCUDA(__FILE__, __LINE__);

  CUMALLOC((void**) &vars.gpu_VDW_Kind, sizeof(int));
    checkLastErrorCUDA(__FILE__, __LINE__);

  CUMALLOC((void**) &vars.gpu_isMartini, sizeof(int));
    checkLastErrorCUDA(__FILE__, __LINE__);

  CUMALLOC((void**) &vars.gpu_count, sizeof(int));
    checkLastErrorCUDA(__FILE__, __LINE__);

  CUMALLOC((void**) &vars.gpu_rCut, sizeof(double));
    checkLastErrorCUDA(__FILE__, __LINE__);<commit_msg>Before mallc<commit_after>/*******************************************************************************
GPU OPTIMIZED MONTE CARLO (GOMC) 2.70
Copyright (C) 2018  GOMC Group
A copy of the GNU General Public License can be found in the COPYRIGHT.txt
along with this program, also can be found at <http://www.gnu.org/licenses/>.
********************************************************************************/
#ifdef GOMC_CUDA
#include <cuda.h>
#include <cuda_runtime.h>
#include "GeomLib.h"
#include "ConstantDefinitionsCUDAKernel.cuh"
#include "CUDAMemoryManager.cuh"
#include <iostream>
#include <stdio.h>

void UpdateGPULambda(VariablesCUDA *vars, int *molIndex, double *lambdaVDW,
                    double *lambdaCoulomb, bool *isFraction)
{
  // copy lambda data
  cudaMemcpy(vars->gpu_molIndex, molIndex, BOX_TOTAL * sizeof(int),
             cudaMemcpyHostToDevice);
  cudaMemcpy(vars->gpu_lambdaVDW, lambdaVDW, BOX_TOTAL * sizeof(double),
             cudaMemcpyHostToDevice);
  cudaMemcpy(vars->gpu_lambdaCoulomb, lambdaCoulomb, BOX_TOTAL * sizeof(double),
             cudaMemcpyHostToDevice);
  cudaMemcpy(vars->gpu_isFraction, isFraction, BOX_TOTAL * sizeof(bool),
             cudaMemcpyHostToDevice);
    checkLastErrorCUDA(__FILE__, __LINE__);

}

void InitGPUForceField(VariablesCUDA &vars, double const *sigmaSq,
                       double const *epsilon_Cn,
                       double const *n, int VDW_Kind, int isMartini,
                       int count, double Rcut, double const *rCutCoulomb,
                       double RcutLow, double Ron, double const *alpha,
                       int ewald, double diElectric_1)
{
  int countSq = count * count;
    checkLastErrorCUDA(__FILE__, __LINE__);

  CUMALLOC((void**) &vars.gpu_sigmaSq, countSq * sizeof(double));
    checkLastErrorCUDA(__FILE__, __LINE__);

  CUMALLOC((void**) &vars.gpu_epsilon_Cn, countSq * sizeof(double));
    checkLastErrorCUDA(__FILE__, __LINE__);

  CUMALLOC((void**) &vars.gpu_n, countSq * sizeof(double));
    checkLastErrorCUDA(__FILE__, __LINE__);

  CUMALLOC((void**) &vars.gpu_VDW_Kind, sizeof(int));
    checkLastErrorCUDA(__FILE__, __LINE__);

  CUMALLOC((void**) &vars.gpu_isMartini, sizeof(int));
    checkLastErrorCUDA(__FILE__, __LINE__);

  CUMALLOC((void**) &vars.gpu_count, sizeof(int));
    checkLastErrorCUDA(__FILE__, __LINE__);

  CUMALLOC((void**) &vars.gpu_rCut, sizeof(double));
    checkLastErrorCUDA(__FILE__, __LINE__);
{'fraction_non_alphanumeric': 0.1711318795430945, 'fraction_numerical': 0.0033229491173416407, 'mean_word_length': 4.20086393088553, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5437777', 'n_tokens_mistral': 1558, 'n_tokens_neox': 1493, 'n_words': 328}