원시데이터 수집 시스템
선정목록으로

A GPU-based large-scale Monte Carlo simulation method for systems with long-range interactions

간접 관련 수소연료전지 · (7) MEA(막전극접합체) (6) PEM(고분자전해질막)

기본 정보

저자
  1. Yihao Liang — Institute of Natural Sciences and Department of Physics and Astronomy, Shanghai Jiao Tong University, Shanghai, 200240 China
  2. Xiangjun Xing — Institute of Natural Sciences and Department of Physics and Astronomy, Shanghai Jiao Tong University, Shanghai, 200240 China
  3. Yaohang Li — Department of Computer Science, Old Dominion University, Norfolk, VA 23529, United States
DOI
10.1016/j.jcp.2017.02.069
저널
Journal of Computational Physics
발행년도
2017
발행기관
Elsevier BV
피인용수
18
라이선스
publisher-specific-oa
논문 유형
–
언어
–
원문 페이지
https://doi.org/10.1016/j.jcp.2017.02.069
토픽
Electrostatics and Colloid Interactions
OpenAlex ID
W2287944230

평가 내용

관련도
간접 관련
사업분야
수소연료전지 · (7) MEA(막전극접합체)
부 분야
(6) PEM(고분자전해질막)
R&D 측면
분석·모델링
확신도
0.70
근거 용어
Monte Carlo simulation, electrolytes, Coulomb many body systems, dielectric constant, ion-ion pair correlation
판단 근거
이 논문은 GPU를 이용한 전해질(electrolytes) 시스템의 몬테카를로 시뮬레이션 방법론을 다루고 있습니다. 이는 코오롱인더스트리의 수소연료전지(PEMFC)용 전해질막(6) 및 MEA(7) 연구에서 이온 전도도, 전해질 내 이온 거동, 유전율 등을 정밀하게 모델링하고 분석하는 데 간접적으로 활용될 수 있습니다.
R&D 활용 포인트
수소연료전지용 고분자전해질막(PEM) 및 MEA 내에서 이온의 이동 메커니즘과 전기적 특성을 시뮬레이션하여 소재의 성능을 예측하고 설계하는 데 활용 가능합니다.
평가 입력
본문 67,067자 중 30,032자 발췌

초록

초록이 없습니다.

본문 67,067자

본문 펼치기
## A GPU-based Large-scale Monte Carlo Simulation Method for Systems with Long-range Interactions Yihao Liang, Xiangjun Xing _Institute_ _of_ _Natural_ _Sciences_ _and_ _Department_ _of_ _Physics_ _and_ _Astronomy,_ _Shanghai_ _Jiao_ _Tong_ _University,_ _Shanghai,_ _200240_ _China_ Yaohang Li _Department_ _of_ _Computer_ _Science,_ _Old_ _Dominion_ _University,_ _Norfolk,_ _VA_ _23529,_ _United_ _States_ Abstract In this work we present an efficient implementation of Canonical Monte Carlo simulation for Coulomb many body systems on graphics processing units (GPU). Our method takes advantage of the GPU Single Instruction, Multiple Data (SIMD) architectures, and adopts the sequential updating scheme of Metropolis algorithm. It makes _no approximation_ in the computation of energy, and reaches a remarkable 440-fold speedup, compared with the serial implementation on CPU. We further use this method to simulate primitive model electrolytes, and measure very precisely all ion-ion pair correlation functions at high concentrations. From these data, we extract the renormalized Debye length, renormalized valences of constituent ions, and renormalized dielectric constants. These results demonstrate unequivocally physics beyond the classical Poisson-Boltzmann theory. _Keywords:_ Monte Carlo, GPU, Parallel Computing, Coulomb Many Body Systems, Electrolytes, Charge Renormalization 1. Introduction Molecular simulations generally fall into two categories: molecular dynamics (MD) and Monte Carlo (MC). In a MD simulation, one solves the Newtonian equation, from which both dynamical and static properties of studied systems can be extracted. In a Monte Carlo simulation, one carries out a Markovian stochastic process which converges to the equilibrium Gibbs distribution. The main advantage of MC is that it can often be accelerated substantially by performing unphysical moves that involve long displacement and/or large number of particles. Hence MC is usually more efficient than MD for simulation of equilibrium systems. _Preprint_ _submitted_ _to_ _Journal_ _of_ _Computational_ _Physics_ _March_ _1,_ _2017_ Long range interactions impose substantial difficulties on numerical simulations, because the computational complexity for one cycle (where every particle moves one step on average) scales as _N_ <sup>2</sup>, in contrast with _N_ for short range interactions, where _N_ is the size of system being simulated. This severely limits the size of feasible simulations. There are three classes of methods to speed up the simulation for long range interacting systems: 1) Multipole expansion methods [1, 2, 3, 4], where interactions are computed approximately using truncated multipole expansions. This reduces the computational complexity to _N_ or _N_ log _N_ . 2) Fourier transforms augmented by Ewald-summations, which reduce the complexity to _N_ <sup>3</sup> <sup>_/_</sup> <sup>2</sup> . It can be further reduced to _N_ log _N_, by using Fast Fourier Transform. Unfortunately, the latter trick is not applicable for MC. Furthermore, additional artifacts arise due to periodic images. For a discussion of these artifacts, see reference [5]. 3) Multi-scale reaction-potential methods [5, 6, 7], whose idea is to simulate only a small portion of the system and use continuum theory to describe the remaining. These methods have difficulty to scale to system with large number of particles, since they do not use any speedup technique in the computation of energy. Graphics processing units (GPU) offer a new possibility for speeding up large scale simulation of long range interacting systems _without_ _sacrificing_ _accuracy_ . GPU is a powerful device which can process thousands of threads simultaneously with high memory bandwidth. Compared to CPU, GPU is designed with more transistors that are devoted to data processing rather than data caching and flow control [8]. It is suitable for computation-intensive and data-parallel computations such as graphics rendering - the original purpose of designing GPU. In recent years, the GPU is devoted to more and more general purpose fields, such as data mining, machine learning, finance, scientific computing and molecular simulation. Many MD simulation methods have already been adapted to GPU in the past years [9, 10, 11, 12, 13, 14, 15, 16]. There are also many MD softwares and libraries that can be implemented on GPU, including AMBER [17, 18, 19, 20] FENZI [21, 22] LAMMPS [23, 24] NAMD [25, 26], HALMD [27], OpenMM [28] HOOMD-blue [29, 30], GROMACS [31], ACEMD[32]. Most of these packages have demonstrated efficiency in simulating long range interacting systems. Implementation of Monte Carlo simulation on GPU turns out to be significantly harder. This is mainly because of the sequential nature of Monte Carlo stochastic dynamics, where particles are moved one by one. Nonetheless, there have been a few attempts to realize MC simulation of Ising model [33, 34, 35] and Hard disk fluid [36] on GPU. A. Yaseen and Y. Li used the remapping method to calculate the total energy on GPU for protein systems [37]. A group at Wayne State University [39, 40] realized a GPU code for Gibbs ensemble MC simulation of simple liquids. J. Kim _et._ _al._ developed an implementation with embarrassing parallel on GPU, 2 where each block performs an individual Monte Carlo simulation [41, 42, 43]. We have not found any previous realization of MC simulation for large-scale long range interacting systems on GPU. In this work, we develop an efficient GPU approach to realize the canonical Monte Carlo of systems with long range interactions. The fundamental idea behind this method is to update every particle once during one invoking of GPU kernel, and to use one (or a few) thread(s) to control one particle in a synchronous mode with coalesced memory access, i.e., to calculate its energy change and to attempt to move it. The same idea has been used in MD simulations in [9], where each thread controls the evolution of one particle. <sup>1</sup> In our case of MC simulation, each thread also has to take care of Monte Carlo trials and decisions. In terms of the interaction table, this parallel metropolis scheme looks like a “brush”, hence we call it _the_ _Brush_ _Metropolis_ _Algorithm_ . This approach enhances temporal locality and thereby improves cache performance. We benchmark this code on a Tesla K20 GPU and find a remarkable 440-fold speedup compared to sequential codes on Intel Xeon E5-2670. It is important to stress that this speedup is achieved _without_ sacrifice of accuracy, since there is no approximation (such as truncated multipole expansion) used in the Brush Metropolis Algorithm. Using this program, we carry out large-scale Monte Carlo simulations of primitive model electrolytes containing as many as 10 <sup>6</sup> ions and measure all pair correlation functions up to extremely high precision. The radius of the simulation box is hundreds of Debye length, so that all boundary artifacts are completely screened. Using this huge amount of data, we are able to measure precisely static linear response properties of the system, including the renormalized valences of constituent ions, the renormalized Debye lengths and renormalized dielectric constant. Comparison of these renormalized parameters with their bare values clearly demonstrates that the statistical physics of concentrated electrolytes is beyond the classical Poisson-Boltzmann theory. The remaining of this paper is organized as follows: In section 2, we compare the feasibility of parallelism in random moving and sequential moving. In section 3, we discuss GPU implementation of sequential moving. We show the benchmark 1However, there are also important differences between these two algorithms. In MD, the only dependency is that the particle coordinates updates and the force computations should be fairly separated in time. To satisfy this dependency, two basic kernels are needed: one is for position updating and the other one is for force computation. Moreover, the force computations are independent so that they can be performed without any inter-thread communication. In comparison, the Hamiltonian change in our MC method is more complicated, due to complex and strong dependency in updating coordinates and energy calculation. In our implementation for MC, the updates of coordinates and the corresponding energy computation are carried out within one kernel and the order of computations and updates together with inter-thread communications are deliberately designed. 3 results and present simulation results for linear response properties of electrolytes in sections 4 and 5, respectively. Section 6 summarizes our conclusions and future research directions. 2. Concurrency In a Metropolis Monte Carlo simulation, a Monte Carlo step is the smallest unit of Markov chain where one particle is moved. A Monte Carlo cycle consists of _N_ steps, where _N_ is the total number of particles. A MC step contains three basic sub-steps: a) Selection : Select a particle _k_, either randomly or sequentially. b) Trial : Propose an unbiased perturbation of the selected particle. The new coordinate of the selected particle _x_ ˜ _k_ is generated by a symmetric probability transition function _T_ ( _x_ _k,_ ˜ _x_ _k_ ) = _T_ (˜ _x_ _k,_ _x_ _k_ ), which yields conditional probability density that _x_ ˜ _k_ is selected as the new coordinate, given the current coordinate is _x_ _k_ . We then calculate the change of total energy ∆ _Ek_ due to this trial. For long range interacting system, the time cost for calculation of ∆ _Ek_ scales with _N_, and therefore is the most computationally expensive substep. c) Acceptance/rejection : Accept the tried state as the next state of the Markov chain with probability min _{_ 1 _, e_ <sup>_−β_</sup> <sup>∆</sup> <sup>_E_</sup> _}_ . The new position is then given by _x_ <sup>_′_</sup> _k_ <sup>=</sup> - _x_ ˜ _k,_ trial accepted; (1) _x_ _k,_ trial rejected _._ Here _β_ = 1 _/_ ( _kBT_ ), _kB_ is the Boltzmann constant and _T_ is the temperature of the system. Substep a) (selection) can be executed in two different ways: 1) Random Updating Scheme, where the particle is selected at random, and 2) Sequential Updating Scheme, where all particles are labeled and moved in ascending order. In Fig. 1, we schematically illustrate several consecutive MC steps in the random updating scheme (left) and the sequential updating orders (right). All particles are labeled by integers 0 _,_ 1 _, . . ., N_ _−_ 1. Each row of figure corresponds to a state in one MC cycle, where the current position of each particle is listed in ascending order. In the random scheme, every particle moves one step _on_ _average_ within one MC cycle. By contrast, in sequential updating scheme, every particle attempts to move exactly once within one cycle. In random updating scheme, the Markov process has a time-independent transition matrix, whereas in sequential scheme, the transition matrix is periodic with periodicity _N_ . Note that detailed balance of the Markov process is guaranteed by the symmetry of the transition function _T_ ( _x_ _,_ ˜ _x_ ), together with the choice of acceptance probability, and therefore is valid for both updating schemes. Because of the Markovian nature of MC simulation, the acceptance ratio of a trial in the random updating scheme depends on all 4 Figure 1: Schematic illustrations of several consecutive MC steps in the random updating scheme (left) and the sequential updating orders (right). Each row denotes a state of the system, and red dashed boxes denote the particles being updated, one in each step. The purple arrows denote the actions of updating, with A/R meaning accept and reject, respectively. In order to determine the results of updates (either acceptation or rejection), one needs to sum of the changes of all pairwise interactions. These are designated by black horizontal arrows with underlying plus signs. details of all prior steps. This severely limits the potential of concurrency of the Random Updating Scheme. By contrast, the potential of concurrency of Sequential Updating Scheme is much higher, as we shall show in detail. Starting from the initial state _{_ _x_ 0 _,_ _x_ 1 _, . . .,_ _x_ _N_ _−_ 1 _}_, we can now propose _N_ random trial new positions _{_ _x_ ˜0 _,_ ˜ _x_ 1 _, . . .,_ ˜ _x_ _N_ _−_ 1 _}_, one for each particle, so that the first several states in one MC cycle are as shown in Fig. 1. To illustrate the interdependency of tasks involved in one MC cycle of the sequential updating scheme, we introduce the graphic representations in Fig. 2 of all involved pairwise interactions that must be calculated during a MC cycle. The horizontal axis is the index of particles (in ascending order), whereas the vertical axis is the time line, with the numbers on the axis label particles selected in each step. Each square element (except the dark ones) denotes the change of a pairwise interaction ∆ _Eij_ in step _i_ where the _i_ -th particle is being tried to move. It is defined as _U_ (˜ _x_ _i −_ _x_ <sup>_′_</sup> _j_ <sup>_′_</sup> _j_ <sup>)</sup> <sup>_−_</sup> <sup>_U_</sup> <sup>(</sup> <sup>_x_</sup> <sup>_i_</sup> <sup>_−_</sup> <sup>_x_</sup> <sup>_′_</sup> _j_ ∆ _Eij_ _≡_    _U_ (˜ _x_ _i −_ _x_ _j_ ) _−_ _U_ ( _x_ _i −_ _x_ _j_ ) _,_ _i < j_ ; (2) <sup>_′_</sup> _j_ <sup>)</sup> <sup>_,_</sup> _i > j._ Now the important point is that for _i_ _<_ _j_, ∆ _Eij_ does not depend on any of new positions _x_ <sup>_′_</sup> _k_ <sup>.</sup> <sup>(All these ∆</sup> <sup>_Eij_</sup> <sup>are shown in the upper triangle in Fig. 2.</sup> <sup>)</sup> <sup>Therefore</sup> they can be calculated simultaneously before any particle is moved. Furthermore, all the squares in one row to the right of diagonal can be summed before any move. Both of these calculations can be done in parallel. Now the 0-th particle is ready to take the trial move, and determines its new position according to Eq. (1). After this, all elements in the 0-th column below 5 Figure 2: Table of pairwise interactions in sequential updating scheme. Each element (except the dark ones) denotes computation of a pairwise interaction. The dark square (one for each row) denotes the action of decision(acceptance or rejection) for the selected particle in each step. “+” denotes the summation of the pairwise interactions in selected region (red region or purple region). Decision must be done after the summations in each row. After the decision in one column is done, all squares below are to be updated. the diagonal line can be calculated independently (because these elements depend only on the new position _x_ <sup>_′_</sup> 0 <sup>,</sup> <sup>but</sup> <sup>not</sup> <sup>on</sup> <sup>others).</sup> <sup>The</sup> <sup>inter-dependency</sup> <sup>of</sup> <sup>these</sup> operations is illustrated in Fig. 2. They can also be added to ∆ _Ei_ independently. After this, particle 1 is ready to take the trial move. The process keeps going until the last particle _N_ is tried. This is the main idea behind our GPU implementation of the sequential updating scheme. 3. GPU implementation We implement the sequential updating scheme with the NVIDIA CUDA programming model and perform simulations and benchmarks on Tesla K20 GPUs. CUDA is a programming platform with extensions of C/C++, which provides a convenient way for parallel programming on NVIDIA GPU. An Nvidia Tesla K20 card includes 13 stream multiprocessor(SMX), each of which has 192 CUDA 6 cores, result in totally 2496 CUDA cores and 1.17 Tflops double-precision peak performance or 3.52 Tflops single-precision peak performance. The size of global memory in a Tesla K20 GPU is 5GB, and in each SMX there is a 48KB shared memory. Details and terminologies of CUDA and GPU architecthure can be found in the CUDA-C programming guide [8]. _3.1._ _Data_ _setting_ _and_ _random_ _numbers_ We use CUDA’s _float_ 4 data type for particle parameters, where _x, y, z_ components are positions and _w_ stores valence of each particle. The information of particles makes up an _N_ -elements array, which is stored in the device’s global memory. In the following text, we denote this array by _Xdev_ . Using _float_ 4 data type with aligned access allows coalesced memory access to the arrays of data in device memory, resulting in efficient memory requests and transfers [8]. All the tasks in MC moves are performed in GPU, except for generation of random numbers. In our program, random numbers are generated by the code “ran4” described in the book _Numerical_ _recipes_ [44]. This code generates single-precision floatingpoint numbers which are uniformly distributed in the interval [0 _,_ 1). We use two _N_ -elements _float_ 4 arrays to store the random numbers used in an MC cycle, one of which is on the host and the other is on the device. The array of random numbers on device is denoted by “rnum” in the following text and pseudo-code. The _x, y, z_ components of an element in “rnum” are used to generate new coordinates whereas _w_ is for decision(acceptance or rejection) in each trial. The computational cost of random number generations can be effectively masked by MC cycles carried out on GPU. This is due to the fact that during the GPU performing a MC cycle, the random numbers for the next MC cycle can be generated simultaneously on CPU supported by concurrent execution between CPU and GPU in CUDA. We use CUDA’s built-in function “cudaMemcpy” to upload the random numbers to the device. Function “cudaMemcpy” contains an intrinsic synchronization so that the system copies data only after the previous GPU job in the same stream finishes. Therefore there is no worry that the random number array changes while the GPU kernel is still using it. Data sampling and analysis can be either on the device or on the host. If we want to put some analysis tasks in CPU cores, we can download this array by built-in functions such as “cudaMemcpy” from device as well. _3.2._ _Decomposition_ When the host program invokes a kernel function of MC cycle, GPU constructs a one-dimensional grid with _B_ thread blocks. Each thread block is one-dimensional and contains _S_ = _⌈N/B⌉_ threads. In the following text, we use a two-element tuple 7 ( _bid, tid_ ) to identify each thread, where _bid_ shows which block the thread locates in and _tid_ is the relative identity of this thread within the block _bid_ . Similarly, the array of particles is divided into _B_ groups, each with _S_ particles. The trial of _p_ ’th particle in group _g_ is assigned to the thread _tid_ = _p_ in block _bid_ = _g_ . In this article, we call the assigned particle the host-particle of corresponding thread. The mission of each thread is to compute the change of energy due to the trial of its host-particle and then decide the acceptance of the new move. At the beginning of kernel grid, each thread loads the information of its host-particle and random number vector from the global memory to its own registers. Then it computes the new position of its host-particle. The total energy change ∆ _Etid_ of the host-particle is stored as a double floating-point variable in thread’s registers, which can be initialized with 0 or the change of its self-energy (if any). The pseudocode of initialization and the statements of symbols are shown in Algorithm 1. _3.3._ _Energy_ _computation_ Despite the positions are represented by single floating-point data type, all the computations related to the energy should be performed by double floating-point operations. The reason is that the energy is a summation of billions of terms which can be either positive or negative in the charged system. Single float treatment in such summation amplifies the truncation error significantly. If there are hard core repulsions between particles, energy may be infinite. To avoid this problem, we can set an individual variable to indicate overlap. All the updating scheme of this indicator is similar to the computation of energy. In the CPU-based sequential program, when the overlap is encountered, we can stop the energy computation and reject the trial directly. This pre-rejection strategy can improve the speed of simulation on CPU, especially in the high volume fraction system. However, this is not a GPU-friendly strategy, due to the fact that this strategy leads to a long divergence path among different MC trials, which offends the SIMD computing scheme of GPU [45] and degrades the parallel efficiency. In this work, we do not use the pre-rejection strategy for two reasons. Firstly, the purpose of this work is to give a general framework on how to parallelize the Metropolis Monte Carlo simulation, where the hard-core repulsion is just a specific choice to deal with the short-range interaction. Secondly, in almost all the systems we study in this work, the volume fraction of particles is low, so that the pre-rejection doesn’t make significant reduction of the computation, and the probability that all threads within a warp be pre-rejected is very low. As a result, the naive pre-rejection strategy on the GPU implementation cannot improve the performance. 8 <u>Algorithm</u> <u>1</u> <u>Statement</u> <u>and</u> <u>initialization</u> Require: bid: the index of block Require: tid: the index of thread in its block Require: B: number of groups and the number of blocks Require: S: number of particles(threads) per group(block) Require: _Xdev_ : Particles’ list on the global memory Require: rnum: Random number sequence on the global memory Require: _D_ : Range of one moving Require: ∆ _E_ : Total change of energy due to the trial of host-particle. It is double precision and located on each thread’s registers. Require: BlockState: An array with B elements on global memory which shows the state of each block. The initial value of each element is 0. The element is 1 if the corresponding block terminated and the coordinates of it’s host particle group updated. Require: _X_ : a float4 vector whose x,y,z components are old coordinates of the host-particle and w component is the valence Require: _X_ <sup>_′_</sup> : a float4 vector whose x,y,z components are new coordinates of the host-particle and w is the random number for decision Require: _Y_ : a _float_ 4 array with B elements on the shared memory, which stores the coordinates of guest particles Require: _λ_ : Bjerrum length _X_ _←_ _Xdev_ [bid*S+tid] _X_ <sup>_′_</sup> _←_ rnum[bid*S+tid] _X_ <sup>_′_</sup> .x _←_ ( _X_ <sup>_′_</sup> .x _−_ 0 _._ 5) _∗_ _D_ _X_ <sup>_′_</sup> .y _←_ ( _X_ <sup>_′_</sup> .y _−_ 0 _._ 5) _∗_ _D_ _X_ <sup>_′_</sup> .z _←_ ( _X_ <sup>_′_</sup> .z _−_ 0 _._ 5) _∗_ _D_ ∆ _E_ _←_ Change of self energy 9 _3.4._ _Intergroup_ _Calculation_ When threads in a block compute interactions with group _J_ where _J̸_ = _bid_ (particles in _J_ are called the guest particles and _J_ is called the guest group ), they perform a brush-like operation which is widely used in MD implementation [9]. Threads in this block firstly load the information of _J_ from the global memory to an _S_ -element float4 array _Y_ on the shared memory. This loading procedure is one-to-one and aligned, so that we can enhance the cache hit rate and reduce the transaction of global memory. After group _J_ loaded (here a synchronize instruction “ ~~s~~ yncthreads” is taken to ensure that all the threads in this block finish loading data of guest-group _J_ ), all threads within this thread block take a loop to calculate the change of pairwise interactions and add them up, as showed in Fig. 3. To avoid the bank conflict and take advantage of broadcasting feature of shared memory, all the loops in this block start at the same index. In this way, threads in the same warp access the same address simultaneously so that the shared memory can broadcast data. We choose 64-bit mode to make full use of the band-width of the shared memory. At last, the block synchronize instruction “ ~~s~~ yncthreads” is taken again to ensure that all threads finish processing the group _J_ before the next group are loaded. Fig. 3 is the schematic illustration of this part. The pseudo-code of this part is shown in algorithm 2. <u>Algorithm</u> <u>2</u> <u>Energy</u> <u>changes</u> <u>with</u> <u>group</u> <u>J</u> <u>(J=bid)</u> _̸_ Y[tid] _←_ _Xdev_ [J*S+tid]; ~~s~~ yncthreads(); for _l_ := 0 to _S −_ 1 do ∆ _E_ _←_ ∆ _E_ + ∆ _U_ ( _X_, _X_ <sup>_′_</sup>,Y[ _l_ ]); end for ~~s~~ yncthreads(); _3.5._ _Self_ _Calculation_ When thread block computes the interactions within its host-group, the procedure involves two main tasks of computations: (1). Compute the upper triangle parts in Fig.4. (2). Decide the trial and calculate the lower triangle parts as in Fig.5. Here we describe the details of these two tasks respectively. _3.5.1._ _Upper_ _triangle_ _part_ The upper triangle of the self-interaction table is independent of any other tasks. Therefore we can pre-calculate them by the brush scheme as before. Thread 10 Figure 3: Schematic illustration of intergroup calculation. In this interaction table, the vertical indices indicate threads in thread block _I_ and horizontal indices specify the particles in group _J_ (= _̸_ _I_ ). Each element stands for a pairwise energy change of corresponding particle pairs. The dashed arrows show the direction of loop for summation. Threads in block _I_ compute and accumulate these pairwise interactions along horizontal direction in sequential order, whereas the energy change on each particle in group _I_ is evaluated in parallel. _tid_ = _p_ computes the change of energy with particles _p_ + 1, _p_ + 2, ..., _S_ _−_ 1 in the host-group. To ensure threads within a warp accessing the same address, the for-loop of each thread should start at _⌊tid/w⌋× w_ + 1. Here _w_ is the size of a warp. In most GPU, _w_ = 32. Fig. 4 is an illustration of this procedure. The pseudo-code for this part is shown in algorithm 3. <u>Algorithm</u> <u>3</u> <u>Upper</u> <u>triangle</u> <u>part</u> <u>of</u> <u>self</u> <u>calculation</u> Y[tid] _←_ _X_ ; ~~s~~ yncthreads(); for _l_ := _⌊tid/w⌋× w_ + 1 to _S −_ 1 do if _l_ _>_ tid then ∆ _E_ _←_ ∆ _E_ + ∆ _U_ ( _X_, _X_ <sup>_′_</sup>,Y[ _l_ ]); end if end for ~~s~~ yncthreads(); In the first _w_ loops, half of the threads on average within a warp are inactive. To reach the full warp efficiency we can use the map algorithm [37, 38, 39]. But this strategy increases usage of registers per thread that limits the number of concurrently executed blocks in one streaming multiprocessor(SMX) and thus decreases the SMX’s efficiency. On the other hand, the computation of the first 11 _w_ loops is light compared with the whole tasks. So we do not implement this strategy in our code for Tesla K20. Figure 4: Upper triangle part of self calculation. _3.5.2._ _Decision_ _and_ _lower_ _triangle_ _part_ The computation of the lower triangle part of the self-interaction table, together with decision of the trial in the host-group, should be performed at last. As shown in Fig. 5, when thread 0 finishes all the summations for ∆ _E_ 0, it can make a decision by comparing with the random number _X_ <sup>_′_</sup> .w under acceptance ratio min _{_ 1 _,_ exp( _−β_ ∆ _E_ 0) _}_ . If _X_ <sup>_′_</sup> .w _<_ min _{_ 1 _,_ exp( _−β_ ∆ _E_ 0) _}_, thread 0 replaces _x_ 0 by _x_ <sup>_′_</sup> 0 <sup>on</sup> <sup>the</sup> <sup>shared</sup> <sup>memory.</sup> <sup>Otherwise</sup> <sup>no</sup> <sup>coordinate</sup> <sup>update</sup> <sup>will</sup> <sup>be</sup> <sup>made.</sup> <sup>After</sup> thread 0 updates the coordinate of 0’th particle, the remaining threads _tid_ _>_ 0 in this block calculate the interactions with the 0’th particle together, and add the results to their own ∆ _Etid_ . Then thread 1 updates the coordinate of particle 1 and the updated energy of particle 1 is propogated to the other threads. This procedure is repeated for other threads until all the host-particles in this block are updated. The last step is to copy the information array of the host-particles from the shared memory to the global memory and set the corresponding flag “BlockState” to be one. The “BlockState” is an array with _B_ elements, each of which indicates the state of corresponding block. Initially all the elements in this array is 0. When 12 Figure 5: Lower triangle part of self calculation. a thread block has written the updated coordinates of its host-particles to the global memory, the corresponding flag BlockState[ _bid_ ] is set to 1. Since CUDA is a weak order programming language, the writing instruction for coordinates and the setting instruction for “BlockState” should be seperated by a “syncthreads”or a “threadfence” instruction to ensure the required executing order viewed in other blocks. The pseudo-code for this part is shown in algorithm 4. _3.6._ _Global_ _procedure_ Fig. 6 shows the global procedure of a thread block. After initialization, threads in this block firstly compute the inter-group interactions with groups _bid_ + 1, _bid_ + 2,. . . _, B −_ 1. Then they compute the internal upper-triangle interactions. The second global loop is to evaluate the interactions with groups 0,1,.., _bid_ _−_ 1. In serial implementation, particles in these groups are updated before the hostparticles. To realize this dependency in the GPU implementation, before loading information of a guest-group _J_, _J_ _< bid_, all threads in this block should wait until the coordinates of particles in guest-group _J_ are updated. Therefore, in each step _J_ of this loop, one of the threads in this block firstly runs a subloop to check and wait until BlockState[ _J_ ] is 1. Finally, threads make the decisions and evaluate the lower-triangle part of self-interaction table. A remaining issue is to reinitialize the flag-array to 0s for the next grid. We 13 <u>Algorithm</u> <u>4</u> <u>Decision</u> <u>and</u> <u>lower</u> <u>triangle</u> <u>part</u> Y[tid] _←_ _X_ ; ~~s~~ yncthreads(); for _l_ := 0 to _S −_ 1 do if (tid= _l_ ) and ( _X_ <sup>_′_</sup> .w _<_ exp( _−λ_ ∆ _E_ )) then _X_ <sup>_′_</sup> .w _←X_ .w; Y[ _l_ ] _←X_ <sup>_′_</sup> ; end if ~~s~~ yncthreads(); if (tid _> l_ ) then ∆ _E_ _←_ ∆ _E_ + ∆ _U_ ( _X_, _X_ <sup>_′_</sup>,Y[ _l_ ]); end if end for _Xdev_ [bid*S+tid] _←_ Y[tid]; ~~s~~ yncthreads(); Thread 0 do: Set BlockState[bid] to be 1 assign this additional work to block _B_ _−_ 1, which is the last one to terminate. Threads in it set all the elements of “BlockState” to 0s so that the next grid can use these indicators directly. The pseudocode for the global procedure is shown in algorithm 5. The above inter-block communications via flags are blocked communications since receivers will not carry out follow-up tasks until receiving the required messages. In a parallel program with blocked communication, we always need to avoid a deadlock state where receivers are waiting for each other and cannot terminate without external force. A case of deadlock in GPU is that all the resident blocks in SMXs are waiting for a message from a block which is not executed yet. In this case, the inactive sender block cannot move forward until one of the resident blocks terminates so that there is enough space to launch this sender block. Therefore, the resident blocks and the inactive sender blocks are waiting for each others. In our implementation, deadlock can be fortunately avoided because each thread block receives messages only from its previous blocks. _3.7._ _Multi-Thread-Per-Particle_ _Treatment_ In above algorithm, one thread is responsible for one particle’s trial. This one-thread-per-particle assignment cannot take full use of device if the number of particles is small because insufficient number of threads are carried out simultaneously to fully take advantage of the capability of GPU. To deal with small system, we take a multi-thread-per-particle assignment, in which the change of energy due to the trial of one particle is evaluated by two or more adjacent threads. 14 <u>Algorithm</u> <u>5</u> <u>Global</u> <u>procedure</u> Initialization for _J_ :=bid+1 to _B −_ 1 do Calculate the energy changes with group _J_ end for Calculate the energy changes of upper triangular part for _J_ := 0 to bid-1 do Thread 0 do: Wait and check until BlockState[ _J_ ]=1 ~~s~~ yncthreads(); Calculate the energy changes with group _J_ end for Decision and lower triangular part if bid=B-1 then Set all the elements of BlockState to 0 <u>end</u> <u>if</u> Figure 6: Global procedure in Monte Carlo kernel. 15 In a program with _η_ -thread-per-particle scheme, the size of thread block is _η_ times of the group size. The energy change of the host particle _k_ ( _k_ is the relative index within its group) will be computed by a bundle of threads _tid_ = _ηk_, _tid_ = _ηk_, ..., _tid_ = _η_ ( _k_ + 1) _−_ 1, with interleaved loops as show in Fig. 7. This interleaved approach is performed in the inter-group evaluation and upper triangle part of self-table. Before the decisions and evaluation of the lower triangle part of self-table, we use warp-reductions to sum up results in all the slave threads of a particle to one. For convenience, _η_ is selected to be 2, 4, 8 and 16, leading 1-step, 2-step, 3-step and 4-step warp shuffle instructions in the reductions. Figure 7: Multi-thread-per-particle assignment for the intergroup evaluation. Each thread block contains 1024 threads. The size of particle group is 256. 4. Benchmark We benchmark the performance of our Brush Metropolis Algorithm on GPU by simulating the primitive model of electrolyte with various numbers of particles, and make a comparison with two other MC implementations: a sequential CPU code and a GPU code with parallel reduction scheme . In the CPU code, the evaluation and summation of the pairwise interactions are performed sequentially without using any acceleration methods. In the GPU code with parallel reduction scheme, each kernel tries to move one particle. There are _N −_ 1 pairwise interactions per trial to be calculated and summed, between the selected particle and the rest of particles in the system. We distribute these _N −_ 1 evaluation to _N_ threads while the thread for the selected particle remains idle. In this reduction kernel, the size of thread block is 1,024, which is the maximum 16 number of threads per block in Tesla K20. The reduction within one block is done by warp shuffle instructions [46], which is an optimized version of parallel reduction [47] for Tesla K20. The intermediate results of warp sums are stored in the shared memory temporarily. We perform warp reduction again with these intermediate results so that the partial sums in this block are integrated. The sub-total of each block is to be added into the global memory atomically. When a block finishes adding the sub-total to the global memory, it should increase a global counter by 1 atomically. This global counter indicates the number of completed thread blocks. Finally, the last block decides acceptance of the proposed particle move. Before the last block updates the coordinate of the selected particle, one of threads in the last block checks this global counter ceaselessly until it indicates completion of summation. This method is straightforward and easy to implement, but it has some drawbacks that limit its performance. Firstly, in the parallel reduction there is a great thread divergency. For a reduction within warp(32 threads), the mean number of active threads is only (32 + 16 + 8 + 4 + 2 + 1) _/_ 6 _≈_ 10 _._ 5, which means about 2 _/_ 3 of computational resources are idle. Secondly, each time when the kernel is invoked, the system needs to take some time to initialize the environment. In this naive method program invokes kernel for _N_ times in a cycle ( _N_ is the number of particles) whereas our Brush Metropolis method just invokes kernel once per cycle. Thus this naive method accumulates a considerable time for initialization. Finally, in each time when the kernel is invoked, the information of particles needs to be reloaded, leading to many global memory transactions and thus low cache efficiency. For the Brush Metropolis GPU code, we mainly measure the performance of one-thread-per-particle approach, with number of particles from 8 _,_ 192 up to 1 _,_ 048 _,_ 576. In addition, we carry out benchmarks of multi-thread-per-particle approach with number of particles from 8 _,_ 192 to 32 _,_ 768. We find that the size of block 1 _,_ 024 exhibits best performance. However, for the multi-thread-per-particle implementation, the number of slave threads per particle _η_ with best performance changes with the size of system. We measure the execution time for 4 small systems, and find the best _η_ for each system, as shown in Table. 1 _<u>N</u>_ <u>Size</u> <u>of</u> <u>thread</u> <u>block</u> _<u>η</u>_ <u>8192</u> <u>1024</u> <u>16</u> <u>16384</u> <u>1024</u> <u>8</u> <u>24576</u> <u>1024</u> <u>4</u> <u>32768</u> <u>1024</u> <u>4</u> Table 1: Parameters We carry out all benchmarks on a Linux machine with 2 _×_ 8 Intel Xeon E5-2630 17 (2.3GHz) CPU cores and two NVIDIA Tesla K20 GPUs. The operating system is Ubuntu 14.04, with the host C-code compiler GCC 4.8.4 and the GPU code compiler CUDA 7.0. The GPU driver’s version is 346.96. The Monte Carlo simulation program on CPU is compiled with optimization option -O3. Both GPU codes are compiled with option -arch=sm 35. Since the GPU implementation of the Brush Metropolis method costs lots of registers, we take option -maxrregcount=65 as the register usage per thread to yield the best performance. Figure 8: Excution time in log-scale. The execution time in log-scale for all three algorithms is showed in Fig.8. It clearly shows that the time complexity of the Brush Metropolis Algorithm with one-thread-per-particle assignment is between the step complexity _O_ ( _N_ ) and the work complexity _O_ ( _N_ <sup>2</sup> ). (The step complexity measures the computational complexity assigned to each thread, including the cost of synchronization.) For particle number less than 50 _,_ 000, the time complexity scales approximately linearly with the step complexity. For even larger particle numbers, the workload of device is nearly saturated so that the time complexity scales with the work complexity. The GPU implementation with parallel reduction has a time complexity between _O_ ( _NlogN_ ) and _O_ ( _N_ <sup>2</sup> ). The speedup of the Brush Metropolis GPU code (comparing with the CPU 18 Figure 9: Speedup of the Brush Metropolis GPU code and the convention GPU code using parallel reduction. Figure 10: Performance comparison between GPU implementations based on parallel reduction and Brush Metropolis on a system with 131,072 particles. Performance data obtained from nvprof. Due to significantly higher L2 cache efficiency, our GPU implementation has better floating point throughput than that of parallel reduction implementation. 19 code) as a function of system size is showed in Fig.9. For large systems the implementation with one-thread-per-particle saturates to approximately 440. In general the Brush Metropolis method exhibits significantly better speedup than the implementation with parallel reduction method, because of less global memory transactions and higher L2 cache efficiency, as well as higher floating point throughput in comparison with parallel reduction method, as shown in Fig.10. The main factor that prevents us from achieving even higher floating point efficiency is the Metropolis-style acceptance and rejection, which generate a divergence path for each proposed move. 5. Simulation of Linear Response Properties of Dense Electrolytes In this section, we use our Brush Metropolis GPU code to carry out a large scale MC simulation of the _primitive_ _model_ electrolytes, which are modeled as charged hard spheres. In the experiment the system contains 1 _,_ 048 _,_ 576 ions, and more than a hundred of Debye length. Because of the huge amount of available data, we are able to measure all pair correlation functions up to _extremely_ _precision_ _and_ _very_ _long_ _scale_ . Using these correlation functions, we determine various renormalized parameters that characterize the linear response properties of the electrolyte, including renormalized valences of the constituent ions, the renormalized Debye length, and the renormalized dielectric constant. These results demonstrate unequivocally that the properties of system are beyond the classical Poisson-Boltzmann theory (PB). We emphasize that in order to compute precisely the long scale properties of electrolytes, it is essentially important to simulate very large system sizes _without_ _making_ _any_ _approximation_ _in_ _long_ _scales_ . This is the main advantage of our GPU code, compared with methods using multipole expansions. _5.1._ _Charge_ _renormalization_ _in_ _concentrated_ _electrolytes_ The classical Poisson-Boltzmann theory (PB) [50] predicts that the mean potential around a fixed ion with charge _Q_ is given by _φ_ = <sup>_<u>Q e−κr</u>_</sup> (3) 4 _πϵr_ <sup>_,_</sup> whereas the effective interaction, i.e., two-ion potential of mean force (PMF), between two ions _Q_ 1 _, Q_ 2 is _U_ 12 = <sup>_<u>Q</u>_</sup> <sup><u>1</u></sup> <sup>_<u>Q</u>_</sup> <sup><u>2</u></sup> <sup>_<u>e−κr</u>_</sup> <sup>_<u>Q</u>_</sup> <sup><u>2</u></sup> <sup>_<u>e−κr</u>_</sup> _._ (4) 4 _πϵr_ In the above equations, _κ_ is the _bare_ inverse Debye length, which, according to PB, is related to bulk ion densities _n_ ¯ _±_ and charges _q±_ via: _κ_ <sup>2</sup> = <sup>_<u>β</u>_</sup> _ϵ_ - _n_ ¯+ _q_ + <sup>2</sup> _−_ + <sup>2</sup> <sup>+ ¯</sup> <sup>_n−q_</sup> _−_ <sup>2</sup> _._ (5) 20 Because the classical PB theory ignores correlation effects, it is not applicable in the concentrated regime. In this regime, the correct far field behaviors of mean potential and two-ion PMF are [48, 49]: _<u>QR e</u>_ <sup>_−κRr_</sup> _φ_ = 4 _πϵRr_ <sup>_,_</sup> (6) <sup>_R_</sup> <u>1</u> <sup>_<u>QR</u>_</sup> <u>2</u> <sup>_<u>e−κRr</u>_</sup> _<u>Q</u>_ <sup>_R_</sup> <u>1</u> _U_ 12 = _,_ (7) 4 _πϵRr_ where _QR, Q_ <sup>_R_</sup> 1 <sup>_, QR_</sup> 2 <sup>_, κR, ϵR_</sup> <sup>are, respectively, the renormalized charges, renormalized</sup> inverse Debye length, and renormalized dielectric constant, which are different from their bare values. There is an exact relation between the renormalized Debye length and renormalized charges of constituent ions: _._ (8) - _<u>κR</u>_ _κ_ �2 = <sup>_<u>q</u>_</sup> <u>+</u> <sup>_R_</sup> <sup>_<u>q</u>_</sup> <u>+</u> <sup>_R_</sup> <sup>_<u>−</u>_</sup> <sup>_<u>q</u>_</sup> _<u>−</u>_ <sup>_R_</sup> _q_ + _−_ _q−_ <u>+</u> <sup>_R_</sup> <sup>_<u>−</u>_</sup> <sup>_<u>q</u>_</sup> _<u>−</u>_ <sup>_R_</sup> Eqs. (6)-(8) are the main results of the _dressed-ion_ _theory_ [48]. We shall compute renormalized valences of constituent ions, renormalized Debye length and renormalized dielectric constant, and finally verify the relation Eq. (8) using large-scale MC simulations. _5.2._ _Simulation_ _Methodology_ To compute all renormalized parameters of dense electrolytes, we perform large scale simulations of electrolytes and measure all pair correlation functions. All our simulations are carried out in the Center for High Performance Computing (HPC) of Shanghai Jiaotong University. To fully take advantage of computation resources, we perform one individual simulation on each GPU card. The number of cards employed in simulation varies according to the ion densities. Typically one data point needs 2 GPU cards, each of which carries out about 2 _,_ 000 iterations with about 5 days. In particular, as the system approaches the charge oscillation regime (where ion densities are high), more Monte Carlo cycles are needed and thus more cards are used. For each simulation(MPI Process), the memory cost on host is 263MB, and the cost of global memory on GPU is about 32MB. The system contains 1 _,_ 024 _×_ 1 _,_ 024 = 1 _,_ 048 _,_ 576 particles with room temperature _T_ = 300 _K_, and relative dielectric constant of the solvent is chosen to be _ϵ_ = 78 _._ 3 and the Bjerrum length _b_ = 7 _._ 117 <sup>˚</sup> _A_ . We use a spherical simulation domain with hard wall boundary conditions. To eliminate influences from the boundary, ions that are less than ten Debye lengths away from the boundary are _not_ used for data collection. The initial state is generated by setting particles uniformly inside the simulation domain with hard core repulsions. The proposed position of the selected particle is uniformly generated inside a cubic center around its original position 21 with size about _L/_ 3 from experience, where _L_ is the size of simulation domain. In the warming iterations we output the total energy to monitor whether the system equilibrates or not. We find that almost all the systems we study can equilibrate in about 10 cycles. Therefore we are sure that for all the systems the correlation between successive configurations is weak. In Fig. 11 we present a typical autocorrelation function of total energy for an equilibrated 3:-1 electrolyte with classical debye length 28 _._ 53 <sup>˚</sup> _A_, whose autocorrelation time is about 2 _._ 3. Here the autocorrelation function of total energy is defined as _Cn_ = <sup><u>(</u></sup> <sup>_<u>Ek −</u>_</sup> <sup>_<u>E</u>_</sup> <sup><u>)(</u></sup> <sup>_<u>Ek</u>_</sup> <sup><u>+</u></sup> <sup>_<u>n −</u>_</sup> <sup>_<u>E</u>_</sup> <sup><u>)</u></sup> _._ (9) ( _Ek −_ _E_ ) <sup>2</sup> Here _Ek_ denotes the total energy at step _k_ and _E_ stands for the mean energy at equilibrium. The over-line can be performed by averaging variable over both ensemble (MPI procedures) and time (steps). The integrated autocorrelation time is defined as _Ck._ (10) _Tc_ = <sup><u>1</u></sup> 2 <sup><u>1</u></sup> 2 <sup>+</sup> _∞_ _k_ =1 Figure 11: Autocorrelation function of a 3:-1 electrolyte. A typical pair correlation function is showed in Fig. 12. 22 Figure 12: A typical radial correlation function of 3:-1 electrolyte. The radius of ions is 3 _._ 75 <sup>˚</sup> _A_ and the classical debye length is 28 _._ 53 <sup>˚</sup> _A_ . The renormalized parameters _κR, ϵR, q±_ <sup>_R_</sup> <sup>can</sup> <sup>be</sup> <sup>obtained</sup> <sup>from</sup> <sup>tails</sup> <sup>of</sup> <sup>pair</sup> <sup>cor-</sup> relation functions _g±±_ ( _r_ ) as follows. Firstly the two-ion PMF are obtained via: _U±±_ ( _r_ ) = _−kBT_ log _g±±_ ( _r_ ) _._ (11) Now, let us fix a positive/negative ion _q_ + _/q−_ at the origin in the bulk electrolyte. The average charge density (excluding the charge _q±_ fixed at the origin) can also be computed by: _ρ_ <sup>_q_</sup> _±_ <sup>(</sup> <sup>_r_</sup> <sup>) =</sup> <sup>_n_</sup> + <sup>_q_</sup> + <sup>_g_</sup> + _±_ <sup>(</sup> <sup>_r_</sup> <sup>) +</sup> <sup>_n_</sup> _−_ <sup>_q_</sup> _−_ <sup>_g_</sup> _−±_ <sup>(</sup> <sup>_r_</sup> <sup>)</sup> <sup>_._</sup> (12) Now the mean potential _φ±_ ( _r_ ) around the fixed ion is given by Eq. (6) with _QR_ replaced by _q±_ <sup>_R_</sup> <sup>in</sup> <sup>the</sup> <sup>far</sup> <sup>field.</sup> <sup>The</sup> <sup>mean</sup> <sup>charge</sup> <sup>density</sup> <sup>_ρ_</sup> _±_ <sup>_q_</sup> <sup>(</sup> <sup>_r_</sup> <sup>)</sup> <sup>can</sup> <sup>be</sup> <sup>obtained</sup> _±_ <sup>_R_</sup> <sup>in</sup> <sup>the</sup> <sup>far</sup> <sup>field.</sup> <sup>The</sup> <sup>mean</sup> <sup>charge</sup> <sup>density</sup> <sup>_ρ_</sup> _±_ <sup>_q_</sup> replaced by _q±_ <sup>_R_</sup> <sup>in</sup> <sup>the</sup> <sup>far</sup> <sup>field.</sup> <sup>The</sup> <sup>mean</sup> <sup>charge</sup> <sup>density</sup> <sup>_ρ_</sup> _±_ <sup>_q_</sup> <sup>(</sup> <sup>_r_</sup> <sup>)</sup> <sup>can</sup> <sup>be</sup> <sup>obtained</sup> using the exact Poisson equation. In the far field, they decay in the form of screened Coulomb potential: _<u>ϵκR</u>_ <sup>2</sup> <sup>_q_</sup> _±_ <sup>(</sup> <sup>_r_</sup> <sup>) =</sup> <sup>_−ϵ∇_</sup> <sup>2</sup> <sup>_φ_</sup> _±_ <sup>(</sup> <sup>_r_</sup> <sup>)</sup> _∼_ _<u>±</u>_ <sup>_Re−κRr_</sup> _ρ_ <sup>_q_</sup> _±_ _<u>R</u>_ <sup>2</sup> <sup>_<u>q</u>_</sup> _<u>±</u>_ <sup>_R_</sup> _._ (13) 4 _πϵRr_ We can take the logarithm of Eq. (13) and obtain: log [ _r ρ_ <sup>_q_</sup> _±_ <sup>(</sup> <sup>_r_</sup> <sup>)]</sup> <sup>_∼_</sup> <sup>log</sup> 23 - _<u>ϵκR</u>_ 2 <sup>_<u>q</u>_</sup> _<u>±</u>_ <sup>_R_</sup> 4 _πϵR_ _−_ _κR r._ (14) Figure 13: Plotting ln( _rρ_ <sup>_q_</sup> _±_ <sup>_/e_</sup> <sup>) v.s.</sup> <sup>_r_</sup> <sup>for 3:-1 electrolyte.</sup> <sup>The radius of ions is 3</sup> <sup>_._</sup> <sup>75˚</sup> <sup>_A_</sup> <sup>and the bare</sup> debye length (as prodicted by PB) is 28 _._ 53 <sup>˚</sup> _A_ . The renormalized Debye length is 25 _._ 57 <sup>˚</sup> _A_ . We can therefore plot the l.h.s. (measured by simulations) as a function of radius _r_, fit the data to straight-lines _in the far field_, and extract the renormalized inverse Debye length _κR_ from their slopes. This is illustrated in Fig. (13). Note that two straight-lines have the same slope and give a renormalized Debye length _κR_ <sup>_−_</sup> <sup>1</sup> = 25 _._ 57 <sup>˚</sup> _A_, manifestly different from the bare Debye length _κ_ <sup>_−_</sup> <sup>1</sup> = 28 _._ 53 <sup>˚</sup> _A_ . According to Eq. (7), the far field asymptotics of the two-ion PMF is _<u>q±</u>_ <sup>_R_</sup> _U±±_ ( _r_ ) _∼_ _<u>±</u>_ <sup>_Rq_</sup> _<u>±</u>_ <sup>_R_</sup> _<u>±</u>_ <sup>_Re−κRr_</sup> _._ (15) 4 _πϵRr_ Taking the ratio of Eqs. (13) and (15), we find the following relation valid in the far field: _q±_ <sup>_R_</sup> _R_ _±_ <sup>_R_</sup> <sup>=</sup> <sup>_−ϵκ_</sup> _R_ <sup>2</sup> _<u>U±±</u>_ <u>(</u> _<u>r</u>_ <u>)</u> _ρ_ <sup>_<u>q</u>_</sup> (16) <sup>_<u>q</u>_</sup> _±_ <sup>(</sup> <sup>_r_</sup> <sup>)</sup> <sup>_._</sup> Since all quantities in the r.h.s. are known, we can use this relation to determine the renormalized charges _q±_ <sup>_R_</sup> <sup>of</sup> <sup>positive</sup> <sup>and</sup> <sup>negative</sup> <sup>ions.</sup> <sup>In</sup> <sup>fact</sup> <sup>we</sup> <sup>have</sup> <sup>two</sup> independent ways to compute the renormalized charges. Let us write them out explicitly: _q_ + <sup>_R_</sup> _R_ + <sup>_R_</sup> = _−ϵκR_ <sup>2</sup> _<u>U</u>_ <u>++(</u> _<u>r</u>_ <u>)</u> _<u>U−</u>_ <u>+(</u> _<u>r</u>_ <u>)</u> _ρ_ <sup>_<u>q</u>_</sup> (17a) <sup>_<u>q</u>_</sup> _−_ <sup>(</sup> <sup>_r_</sup> <sup>)</sup> <sup>_,_</sup> _ρ_ <sup>_<u>q</u>_</sup> _R_ _<u>U−−</u>_ <u>(</u> _<u>r</u>_ <u>)</u> _q−_ <sup>_R_</sup> _R_ _−_ <sup>_R_</sup> = _−ϵκR_ <sup>2</sup> _<u>U</u>_ <u>+</u> _<u>−</u>_ <u>(</u> _<u>r</u>_ <u>)</u> _ρ_ <sup>_<u>q</u>_</sup> <sup>_<u>q</u>_</sup> + <sup>(</sup> <sup>_r_</sup> <sup>)</sup> <sup>=</sup> <sup>_−ϵκ_</sup> _R_ <sup>2</sup> <u>+</u> _<u>−</u>_ <u>(</u> _<u>r</u>_ <u>)</u> <sup>_<u>q</u>_</sup> + <sup>(</sup> <sup>_r_</sup> <sup>)</sup> <sup>=</sup> <sup>_−ϵκ_</sup> _R_ <sup>2</sup> _R_ _ρ_ <sup>_<u>q</u>_</sup> (17b) <sup>_<u>q</u>_</sup> _−_ <sup>(</sup> <sup>_r_</sup> <sup>)</sup> <sup>_._</sup> The data for one particular simulation are shown in Fig. 14, from which we extract the renormalized charges of positive and negative ions to be 4.125 and -0.884 re 24 spectively. Note that these are substantially different from the bare charges, which are 3 and -1 respectively. This charge renormalization arises as a consequence of ionic correlations and signify the failure of the classical PB theory. Using Eq. (13) we can compute the renormalized dielectric constant _ϵR_ in terms of _κR, q±_ <sup>_R_</sup> <sup>,</sup> <sup>and</sup> <sup>_ρ_</sup> _±_ <sup>_q_</sup> <sup>(</sup> <sup>_r_</sup> <sup>)</sup> <sup>(again</sup> <sup>in</sup> <sup>two</sup> <sup>independent</sup> <sup>ways):</sup> _±_ <sup>_R_</sup> <sup>,</sup> <sup>and</sup> <sup>_ρ_</sup> _±_ <sup>_q_</sup> _±_ <sup>_q_</sup> <sup>(</sup> <sup>_r_</sup> <sup>)</sup> <sup>(again</sup> <sup>in</sup> <sup>two</sup> <sup>independent</sup> <sup>ways):</sup> _<u>R</u>_ <sup>2</sup> <sup>_<u>q</u>_</sup> _<u>±</u>_ <sup>_R_</sup> _ϵR_ = _−ϵ_ <sup>_<u>κ</u>_</sup> _<u>R</u>_ <sup>2</sup> 4 _<u>±</u>_ <sup>_Re−κRr_</sup> <sup>2</sup> (18) 4 _πr ρ_ <sup>_<u>q</u>_</sup> _±_ <sup>(</sup> <sup>_r_</sup> <sup>)</sup> <sup>_._</sup> Finally, we also use the computed _κR_ and _q±_ <sup>_R_</sup> Finally, we also use the computed _κR_ and _q±_ <sup>_R_</sup> <sup>to test the validity of the exact relation</sup> Eq. (8). The results are displayed in Fig. 15(a). Additionally, we plot _q±_ <sup>_R_</sup> <sup>and</sup> <sup>_κR_</sup> Eq. (8). The results are displayed in Fig. 15(a). Additionally, we plot _q±_ <sup>_R_</sup> <sup>and</sup> <sup>_κR_</sup> in Figs. 15(b) and 15(c) respectively measured in two independent ways and show that they are consistent with each other, within computational errors. All these numerical tests unambiguously demonstrate the validity and internal consistency of the dressed-ion theory, Eqs. (6)-(8). Figure 14: Plotting _βU_ v.s. _ρ_ <sup>_q_</sup> _/e_ for 3:-1 electrolyte. The radius of ions is 3 _._ 75 <sup>˚</sup> _A_ and the classical debye length is 28 _._ 53 <sup>˚</sup> _A_ . Using Eq. (17) and fitting the long rang data to straight-lines, we obtain the renormalized valences of the positive ion and of the negative ions to be 4.125 and -0.884 respectively, which are different from the bare valences 3 and -1 respectively. This again demonstrates the failure of classical PB theory. 6. Conclusion In this work, we have developed an efficient GPU code for large-scale Monte Carlo simulation of Coulomb many-body systems, which parallelizes the sequential 25 ��� �� � �� ��� - <sup>��</sup> �� � �� �� �� Ε _R_ �Ε <u>0.70</u> <u>0.75</u> <u>0.80</u> <u>0.85</u> <u>0.90</u> <u>0.95</u> <u>1.00</u> (c) �� 2.4 2.2 2.0 1.8 1.6 1.4 1.2 �� � � �� � <sup>�</sup> � _qR_ �e 6 5 4 3 2 1 - 2:�1, d�7.5 - 3:�1, d�7.5 - 1:�1, d�10 - 3:�1, d�24 � - 2:�1, d�7.5 - 3:�1, d�7.5 - 1:�1, d�10 - 3:�1, d�24 - 2:�1, d�7.5 - 3:�1, d�7.5 - 3:�1, d�24 - ����� - ����� - �� �� �� �� <sup>�</sup> ��� �� ��� � �� ��� �� � <sup>�</sup> - � �� �� �� Ε _R_ �Ε 1.00 0.95 0.90 0.85 0.80 0.75 0.70 ~~<u>�</u>~~ <u>1.2</u> <u>1.4</u> <u>1.6</u> <u>1.8</u> <u>2.0</u> <u>2.2</u> <u>2.4</u> <sup>�Κ</sup> <sup>_R_</sup> <sup>�Κ�2</sup> _qR_ �e <u>1</u> <u>2</u> <u>3</u> <u>4</u> <u>5</u> <u>6</u> (b) (a) Figure 15: (a):Verification of the exact relation Eq. (8) using MC simulation. _d_ is the ion diameter (in the unit of <sup>˚</sup> _A_ ). Vertical axis: - _q_ + <sup>_R_</sup> <sup>_−_</sup> <sup>_q_</sup> _−_ <sup>_R_</sup> - _/_ ( _q_ + _−_ _q−_ ). (b): The renormalized valences diameter (in the unit of <sup>˚</sup> _A_ ). Vertical axis: - _q_ + <sup>_R_</sup> <sup>_−_</sup> <sup>_q_</sup> _−_ <sup>_R_</sup> - _/_ ( _q_ + _−_ _q−_ ). (b): The renormalized valences of ions, computed using in two independent ways, see Eqs. (17). The purpose of this panel is to demonstrate that two independent computations give the same result, within computational errors. (c): Renormalized dielectric constant can also be computed in two ways, see (18). The fact that these renormalized parameters are different from their bare values demonstrates that the properties of concentrated electrolytes are beyond the classical Poisson-Boltzmann theory. - _q_ + <sup>_R_</sup> _−_ <sup>_R_</sup> + <sup>_R_</sup> <sup>_−_</sup> <sup>_q_</sup> _−_ <sup>_R_</sup> updating scheme and achieves an acceleration of 440 over the sequential CPU code, without sacrificing accuracy. We have further applied this method to precisely measure the long scale linear response properties of dense asymmetric electrolytes and have demonstrated that they are beyond the classical Poisson-Boltzmann theory. Further applications of this method will be reported in future publications. Y.H. Liang and X.J. Xing acknowledge financial support from NSFC (grant No. 11174196 and 91130012). Y.H. Li acknowledges support from NSF (grant No. 1066471). The authors also thank Beijing Computational Science Research Center (BCSRC) for hospitality, where part of this work is done. This work is supported by Center for HPC, Shanghai Jiao Tong University. References [1] Andrew W. Appel. An efficient program for many-body simulation. SIAM J. Sci. Stat. Comput., 6(1):85, Jan 1985. [2] Josh Barnes and Piet Hut. A hierarchical o(n log n) force-calculation algo rithm. Nature, 324(4):446, Dec 1986. [3] L. Greengard and V. Rokhlin. A fast algorithm for particle simulations. Jour- nal of Computational Physics, 73(2):325–348, 1987. [4] Gan Zecheng and Xu Zhenli. Efficient implementation of the barnes-hut octree algorithm for monte carlo simulations of charged systems. Science China, Mathematics, 57(7):1331–1340, July 2014. 26 [5] Yihao Liang, Zhenli Xu, and Xiangjun Xing. A multi-scale Monte Carlo method for electrolytes New J. Phys., 17(2015), 083082. [6] Zhenli Xu, Yihao Liang, Xiangjun Xing. Mellin Transform and Image Charge Method for Dielectric Sphere in an Electrolyte. SIAM J. Appl. Math., 73 (4), 1396-1415.(2013). [7] Y. Lin, A. Baumketner, S. Deng, Z. Xu, D. Jacobs, and W. Cai. An image based reaction field method for electrostatic interactions in molecular dynamics simulations of aqueous solutions. J. Chem. Phys., 131:154103, 2009. [8] NVIDIA. <u>CUDA</u> <u>C</u> <u>Programming</u> <u>Guide.</u> NVIDIA, 7.0 edition, Mar 2015. [9] Lars Nyland, Mark Harris, and Jan Prins. Fast n-body simulation with cuda. `[http://http.developer.nvidia.com/GPUGems3/gpugems3_ch31.html](http://http.developer.nvidia.com/GPUGems3/gpugems3_ch31.html)` . [10] Carolyn L. Phillips, Joshua A. Anderson, and Sharon C. Glotzer. Pseudo random number generation for brownian dynamics and dissipative particle dynamics simulations on gpu devices. Journal of Computational Physics, 230:7191–7201, 2011. [11] Tsuyoshi Hamada and Toshiaki Iitaka. The chamomile scheme: An optimized algorithm for n-body simulations on programmable graphics processing units. arXiv:astro-ph /0703100v1, 2007. [12] Evghenii Gaburov, Jeroen B´edorf, and Simon Portegies Zwart. Gravitational tree-code on graphics processing units: implementation in cuda. In Procedia Computer Science, volume 1, pages 1119–1127. International Conference on Computational Science, ICCS 2010, 2012. [13] Juekuan Yang, Yujuan Wang, and Yunfei Chen. Gpu accelerated molecular dynamics simulation of thermal conductivities. Journal of Computational Physics, 221:799–804, 2007. [14] Trung Dac Nguyen, Carolyn L. Phillips, Joshua A. Anderson, and Sharon C. Glotzer. Rigid body constraints realized in massively-parallel molecular dynamics on graphics processing units. Computer Physics Communications, 182:2307–2313, 2011. [15] Weiguo Liu, Bertil Schmidt, Gerrit Voss, and Wolfgang M¨uller-Wittig. Accel erating molecular dynamics simulations using graphics processing units with cuda. Computer Physics Communications, 179:634–641, 2008. 27 [16] D.C. Rapaport. Enhanced molecular dynamics performance with a programmable graphics processor. Computer Physics Communications, 182:926–934, 2011. [17] Andreas W. G¨otz, Mark J. Williamson, Dong Xu, Duncan Poole, Scott Le Grand, and Ross C. Walker. Routine microsecond molecular dynamics simulations with amber on gpus. 1. generalized born. Journal of Chemical Theory and Computation, 8:1542–1555, 2012. [18] Romelia Salomon-Ferrer, Andreas W. G¨otz, Duncan Poole, Scott Le Grand, and Ross C. Walker. Routine microsecond molecular dynamics simulations with amber on gpus. 2. explicit solvent particle mesh ewald. Journal of Chemical Theory and Computation, 9:3878–3888, 2013. [19] Romelia Salomon-Ferrer, David A. Case, and Ross C. Walker. An overview of the amber biomolecular simulation package. WIREs Computational Molecular Science, 3:198–210, Mar 2013. [20] Scott Le Grand, Andreas W. G¨otz, and Ross C. Walker. Spfp: Speed without compromise—a mixed precision model for gpu accelerated molecular dynamics simulations. Computer Physics Communications, 184:374–380, 2013. [21] Michela Taufer, Narayan Ganesan, and Sandeep Patel. Gpu-enabled macro molecular simulation: Challenges and opportunities. Computing in Science & Engineering, pages 56–65, 2013. [22] Narayan Ganesan Brad A. Bauer Timothy R. Lucas Sandeep Patel and Michela Taufer. Structural, dynamic, and electrostatic properties of fully hydrated dmpc bilayers from molecular dynamics simulations accelerated with graphical processing units (gpus). Journal of Computational Chemistry, 32:2958–2973, 2011. [23] William Michael Brown, Steven James Plimpton, Peng Wang, Pratul K. Agar wal, Scott Hampton, and Paul Stewart Crozier. Porting lammps to gpus. In SciTech Connect, Savannah, GA., 2010. Proposed for presentation at the SOS 14 Conference. [24] W. Michael Brown, Peng Wang, Steven J. Plimpton, and Arnold N. Tharring ton. Implementing molecular dynamics on hybrid high performance computers - short range forces. Computer Physics Communications, 182:898–911, 2011. 28 [25] John E. Stone, James C. Phillips, Peter L. Freddolino, David J. Hardy, Leonardo G. Trabuco, and Klaus Schulten. Accelerating molecular modeling applications with graphics processors. Wiley InterScience, 2007. [26] James C. Phillips, John E. Stone, and Klaus Schulten. Adapting a message driven parallel application to gpu-accelerated clusters. In Proceedings of the 2008 ACM/IEEE Conference on Supercomputing, page 1, Austin,Texas, 2008. IEEE/ACM, IEEE Press. [27] Peter H. Colberg and Felix H¨ofling. Highly accelerated simulations of glassy dynamics using gpus: Caveats on limited floating-point precision. Computer Physics Communications, 182:1120–1129, 2011. [28] Peter Eastman and Vijay S. Pande. Efficient nonbonded interactions for molecular dynamics on a graphics processing unit. Journal of Computational Chemistry, 31:1268–1272, 2010. [29] Joshua A. Anderson, Chris D. Lorenz, and A. Travesset. General purpose molecular dynamics simulations fully implemented on graphics processing units. Journal of Computational Physics, 227:5342–5359, 2008. [30] Hoomd-blue. `[http://codeblue.umich.edu/hoomd-blue/](http://codeblue.umich.edu/hoomd-blue/)` . [31] Gromacs. `[http://www.gromacs.org](http://www.gromacs.org)` . [32] Acemd. `[ttps://www.acellera.com](ttps://www.acellera.com)` . [33] Benjamin Block, Peter Virnau, and Tobias Preis. Multi-gpu accelerated multi spin monte carlo simulations of the 2d ising model. Computer Physics Communications, 181:1549–1556, 2010. [34] Tobias Preis, Peter Virnau, Wolfgang Paul, and Johannes J. Schneider. Gpu accelerated monte carlo simulation of the 2d and 3d ising model. Journal of Computational Physics, 228:4468–4477, 2009. [35] Tal Levy, Guy Cohen, and Eran Rabani. Simulating lattice spin models on graphics processing units. Journal of Chemical Theory and Computation, 6:3293–3301, 2010. [36] Joshua A. Anderson, Eric Jankowski, Thomas L. Grubb, Michael Engel, and Sharon C. Glotzer. Massively parallel monte carlo for many-particle simulations on gpus. Journal of Computational Physics, 254:27–38, 2013. 29 [37] Ashraf Yaseen and Yaohang Li. Accelerating knowledge-based energy evalu ation in protein structure modeling with graphics processing units. Journal of Parallel and Distributed Computing, 72:297–307, 2012. [38] Ashraf Yaseen and Yaohang Li. A Load-Balancing Workload Distribution Scheme for Three-Body Interaction Computation on Graphics Processing Units (GPU). Journal of Parallel and Distributed Computing, 87:91– 101, 2016. [39] Jason Mick, Eyad Hailat, Vincent Russo, Kamel Rushaidat, Loren Schwiebert, and Jeffrey Potoff. Gpu-accelerated gibbs ensemble monte carlo simulations of lennard-jonesium. Computer Physics Communications, 184:2662–2669, 2013. [40] Eyad Hailat, Vincent Russo, Kamel Rushaidat, Jason Mick, Loren Schwieberto, Kamel Rushaidat, Jason Mick, Loren Schwiebert, and Jeffrey Potoff. Parallel monte carlo simulation in the canonical ensemble on the graphics processing unit. International Journal of Parallel, Emergent and Distributed Systems, 29(4):379–400, 2014. [41] Jihan Kim and Jocelyn M. Rodgers and Manuel Ath enes and Berend Smit Molecular Monte Carlo Simulations Using Graphics Processing Units: To Waste Recycle or Not? Journal of Chemical Theory and Computation, 7:3208–3222, 2011 [42] Jihan Kim and Berend Smit Efficient Monte Carlo Simulations of Gas Molecules Inside Porous Materials Journal of Chemical Theory and Computation, 8:2336–2343, 2012 [43] Jihan Kim and Richard L. Martin and Oliver RÃijbel and Maciej Haranczyk and Berend Smit High-Throughput Characterization of Porous Materials Using Graphics Processing Units Journal of Chemical Theory and Computation, 8:1684–1693, 2012 [44] William H. Press and Saul A. Teukolsky. Numerical Recipes . 9780521431088. Cambridge University Press, 3rd edition, August 2007. [45] Wenjian Yu, Kuangya Zhai, Hao Zhuang, Junqing Chen/ Accelerated floating random walk algorithm for the electrostatic computation with 3-D rectilinearshaped conductors Simulation Modelling Practice and Theory, 34:2036, 2013 30 [46] Justin Luitjens. Faster parallel reductions on kepler. `[http://devblogs.](http://devblogs.nvidia.com/parallelforall/faster-parallel-reductions-kepler/)` `[nvidia.com/parallelforall/faster-parallel-reductions-kepler/](http://devblogs.nvidia.com/parallelforall/faster-parallel-reductions-kepler/)`, Feb 2014. [47] Mark Harris. Optimizing parallel reduction in cuda. `[http://developer.](http://developer.download.nvidia.com/assets/cuda/files/reduction.pdf)` `[download.nvidia.com/assets/cuda/files/reduction.pdf](http://developer.download.nvidia.com/assets/cuda/files/reduction.pdf)`, 2008. [48] Roland Kjellander and D John Mitchell. An exact but linear and poisson— boltzmann-like theory for electrolytes and colloid dispersions in the primitive model. Chemical physics letters, 200(1):76–82, 1992. Roland Kjellander and D. John Mitchell. Dressed ion theory for electrolyte solutions: A Debye-H¨uckel-like reformulation of the exact theory for the primitive model. The Journal of Chemical Physics, 101(1):603–626, 1994. [49] Mingnan Ding, Yihao Liang, Bing-sui Lu, and Xiangjun Xing. Charge Renor malization and Charge Oscillation in Asymmetric Primitive Model. Submitted to Journal of Statistical Physics . [50] D. Andelman. _Electrostatic_ _Properties_ _of_ _Membranes:_ _The_ _Poisson-_ _Boltzmann_ _Theory._, chapter 12. Structure and Dynamics of Membranes Generic and Specific Interactions. ELSEVIER, Amsterdam, 1995. 31

섹션 본문 57문단 · 41,664자

(제목 없음)

1In this work we present an efficient implementation of Canonical Monte Carlo simulation for Coulomb many body systems on graphics processing units (GPU). Our method takes advantage of the GPU Single Instruction, Multiple Data (SIMD) architectures, and adopts the sequential updating scheme of Metropolis algorithm. It makes no approximation in the computation of energy, and reaches a remarkable 440-fold speedup, compared with the serial implementation on CPU. We further use this method to simulate primitive model electrolytes, and measure very precisely all ion-ion pair correlation functions at high concentrations. From these data, we extract the renormalized Debye length, renormalized valences of constituent ions, and renormalized dielectric constants. These results demonstrate unequivocally physics beyond the classical Poisson-Boltzmann theory.

Introduction

2Molecular simulations generally fall into two categories: molecular dynamics (MD) and Monte Carlo (MC). In a MD simulation, one solves the Newtonian equation, from which both dynamical and static properties of studied systems can be extracted. In a Monte Carlo simulation, one carries out a Markovian stochastic process which converges to the equilibrium Gibbs distribution. The main advantage of MC is that it can often be accelerated substantially by performing unphysical moves that involve long displacement and/or large number of particles. Hence MC is usually more efficient than MD for simulation of equilibrium systems.

3Long range interactions impose substantial difficulties on numerical simulations, because the computational complexity for one cycle (where every particle moves one step on average) scales as N 2 , in contrast with N for short range interactions, where N is the size of system being simulated. This severely limits the size of feasible simulations. There are three classes of methods to speed up the simulation for long range interacting systems: 1) Multipole expansion methods [1,2,3,4], where interactions are computed approximately using truncated multipole expansions. This reduces the computational complexity to N or N log N . 2) Fourier transforms augmented by Ewald-summations, which reduce the complexity to N 3/2 . It can be further reduced to N log N , by using Fast Fourier Transform. Unfortunately, the latter trick is not applicable for MC. Furthermore, additional artifacts arise due to periodic images. For a discussion of these artifacts, see reference [5]. 3) Multi-scale reaction-potential methods [5,6,7], whose idea is to simulate only a small portion of the system and use continuum theory to describe the remaining. These methods have difficulty to scale to system with large number of particles, since they do not use any speedup technique in the computation of energy.

4Graphics processing units (GPU) offer a new possibility for speeding up large scale simulation of long range interacting systems without sacrificing accuracy. GPU is a powerful device which can process thousands of threads simultaneously with high memory bandwidth. Compared to CPU, GPU is designed with more transistors that are devoted to data processing rather than data caching and flow control [8]. It is suitable for computation-intensive and data-parallel computations such as graphics rendering -the original purpose of designing GPU. In recent years, the GPU is devoted to more and more general purpose fields, such as data mining, machine learning, finance, scientific computing and molecular simulation.

5Many MD simulation methods have already been adapted to GPU in the past years [9,10,11,12,13,14,15,16]. There are also many MD softwares and libraries that can be implemented on GPU, including AMBER [17,18,19,20] FENZI [21,22] LAMMPS [23,24] NAMD [25,26], HALMD [27], OpenMM [28] HOOMD-blue [29,30], GROMACS [31], ACEMD [32]. Most of these packages have demonstrated efficiency in simulating long range interacting systems.

6Implementation of Monte Carlo simulation on GPU turns out to be significantly harder. This is mainly because of the sequential nature of Monte Carlo stochastic dynamics, where particles are moved one by one. Nonetheless, there have been a few attempts to realize MC simulation of Ising model [33,34,35] and Hard disk fluid [36] on GPU. A. Yaseen and Y. Li used the remapping method to calculate the total energy on GPU for protein systems [37]. A group at Wayne State University [39,40] where each block performs an individual Monte Carlo simulation [41,42,43]. We have not found any previous realization of MC simulation for large-scale long range interacting systems on GPU.

7In this work, we develop an efficient GPU approach to realize the canonical Monte Carlo of systems with long range interactions. The fundamental idea behind this method is to update every particle once during one invoking of GPU kernel, and to use one (or a few) thread(s) to control one particle in a synchronous mode with coalesced memory access, i.e., to calculate its energy change and to attempt to move it. The same idea has been used in MD simulations in [9], where each thread controls the evolution of one particle. 1 In our case of MC simulation, each thread also has to take care of Monte Carlo trials and decisions. In terms of the interaction table, this parallel metropolis scheme looks like a "brush", hence we call it the Brush Metropolis Algorithm.

8This approach enhances temporal locality and thereby improves cache performance. We benchmark this code on a Tesla K20 GPU and find a remarkable 440-fold speedup compared to sequential codes on Intel Xeon E5-2670. It is important to stress that this speedup is achieved without sacrifice of accuracy, since there is no approximation (such as truncated multipole expansion) used in the Brush Metropolis Algorithm. Using this program, we carry out large-scale Monte Carlo simulations of primitive model electrolytes containing as many as 10 6 ions and measure all pair correlation functions up to extremely high precision. The radius of the simulation box is hundreds of Debye length, so that all boundary artifacts are completely screened. Using this huge amount of data, we are able to measure precisely static linear response properties of the system, including the renormalized valences of constituent ions, the renormalized Debye lengths and renormalized dielectric constant. Comparison of these renormalized parameters with their bare values clearly demonstrates that the statistical physics of concentrated electrolytes is beyond the classical Poisson-Boltzmann theory.

9The remaining of this paper is organized as follows: In section 2, we compare the feasibility of parallelism in random moving and sequential moving. In section 3, we discuss GPU implementation of sequential moving. We show the benchmark 1 However, there are also important differences between these two algorithms. In MD, the only dependency is that the particle coordinates updates and the force computations should be fairly separated in time. To satisfy this dependency, two basic kernels are needed: one is for position updating and the other one is for force computation. Moreover, the force computations are independent so that they can be performed without any inter-thread communication. In comparison, the Hamiltonian change in our MC method is more complicated, due to complex and strong dependency in updating coordinates and energy calculation. In our implementation for MC, the updates of coordinates and the corresponding energy computation are carried out within one kernel and the order of computations and updates together with inter-thread communications are deliberately designed. results and present simulation results for linear response properties of electrolytes in sections 4 and 5, respectively. Section 6 summarizes our conclusions and future research directions.

Concurrency

10In a Metropolis Monte Carlo simulation, a Monte Carlo step is the smallest unit of Markov chain where one particle is moved. A Monte Carlo cycle consists of N steps, where N is the total number of particles. A MC step contains three basic sub-steps: a) Selection: Select a particle k, either randomly or sequentially. b) Trial: Propose an unbiased perturbation of the selected particle. The new coordinate of the selected particlex k is generated by a symmetric probability transition function T (x k ,x k ) = T (x k , x k ), which yields conditional probability density thatx k is selected as the new coordinate, given the current coordinate is x k . We then calculate the change of total energy ∆E k due to this trial. For long range interacting system, the time cost for calculation of ∆E k scales with N , and therefore is the most computationally expensive substep. c) Acceptance/rejection: Accept the tried state as the next state of the Markov chain with probability min{1, e −β∆E }. The new position is then given by

11Here β = 1/(k B T ), k B is the Boltzmann constant and T is the temperature of the system. Substep a) (selection) can be executed in two different ways: 1) Random Updating Scheme, where the particle is selected at random, and 2) Sequential Updating Scheme, where all particles are labeled and moved in ascending order. In Fig. 1, we schematically illustrate several consecutive MC steps in the random updating scheme (left) and the sequential updating orders (right). All particles are labeled by integers 0, 1, . . . , N − 1. Each row of figure corresponds to a state in one MC cycle, where the current position of each particle is listed in ascending order. In the random scheme, every particle moves one step on average within one MC cycle. By contrast, in sequential updating scheme, every particle attempts to move exactly once within one cycle. In random updating scheme, the Markov process has a time-independent transition matrix, whereas in sequential scheme, the transition matrix is periodic with periodicity N . Note that detailed balance of the Markov process is guaranteed by the symmetry of the transition function T (x,x), together with the choice of acceptance probability, and therefore is valid for both updating schemes. Because of the Markovian nature of MC simulation, the acceptance ratio of a trial in the random updating scheme depends on all details of all prior steps. This severely limits the potential of concurrency of the Random Updating Scheme. By contrast, the potential of concurrency of Sequential Updating Scheme is much higher, as we shall show in detail. Starting from the initial state {x 0 , x 1 , . . . , x N −1 }, we can now propose N random trial new positions {x 0 ,x 1 , . . . ,x N −1 }, one for each particle, so that the first several states in one MC cycle are as shown in Fig. 1. To illustrate the interdependency of tasks involved in one MC cycle of the sequential updating scheme, we introduce the graphic representations in Fig. 2 of all involved pairwise interactions that must be calculated during a MC cycle. The horizontal axis is the index of particles (in ascending order), whereas the vertical axis is the time line, with the numbers on the axis label particles selected in each step. Each square element (except the dark ones) denotes the change of a pairwise interaction ∆E ij in step i where the i-th particle is being tried to move. It is defined as

12Now the important point is that for i < j, ∆E ij does not depend on any of new positions x k . (All these ∆E ij are shown in the upper triangle in Fig. 2. ) Therefore they can be calculated simultaneously before any particle is moved. Furthermore, all the squares in one row to the right of diagonal can be summed before any move. Both of these calculations can be done in parallel. Now the 0-th particle is ready to take the trial move, and determines its new position according to Eq. (1). After this, all elements in the 0-th column below Table of pairwise interactions in sequential updating scheme. Each element (except the dark ones) denotes computation of a pairwise interaction. The dark square (one for each row) denotes the action of decision(acceptance or rejection) for the selected particle in each step. "+" denotes the summation of the pairwise interactions in selected region (red region or purple region). Decision must be done after the summations in each row. After the decision in one column is done, all squares below are to be updated. the diagonal line can be calculated independently (because these elements depend only on the new position x 0 , but not on others). The inter-dependency of these operations is illustrated in Fig. 2. They can also be added to ∆E i independently. After this, particle 1 is ready to take the trial move. The process keeps going until the last particle N is tried. This is the main idea behind our GPU implementation of the sequential updating scheme.

GPU implementation

13We implement the sequential updating scheme with the NVIDIA CUDA programming model and perform simulations and benchmarks on Tesla K20 GPUs. CUDA is a programming platform with extensions of C/C++, which provides a convenient way for parallel programming on NVIDIA GPU. An Nvidia Tesla K20 card includes 13 stream multiprocessor(SMX), each of which has 192 CUDA cores, result in totally 2496 CUDA cores and 1.17 Tflops double-precision peak performance or 3.52 Tflops single-precision peak performance. The size of global memory in a Tesla K20 GPU is 5GB, and in each SMX there is a 48KB shared memory. Details and terminologies of CUDA and GPU architecthure can be found in the CUDA-C programming guide [8].

Data setting and random numbers

14We use CUDA's f loat4 data type for particle parameters, where x, y, z components are positions and w stores valence of each particle. The information of particles makes up an N -elements array, which is stored in the device's global memory. In the following text, we denote this array by X dev . Using f loat4 data type with aligned access allows coalesced memory access to the arrays of data in device memory, resulting in efficient memory requests and transfers [8]. All the tasks in MC moves are performed in GPU, except for generation of random numbers.

15In our program, random numbers are generated by the code "ran4" described in the book Numerical recipes [44]. This code generates single-precision floatingpoint numbers which are uniformly distributed in the interval [0, 1). We use two N -elements f loat4 arrays to store the random numbers used in an MC cycle, one of which is on the host and the other is on the device. The array of random numbers on device is denoted by "rnum" in the following text and pseudo-code. The x, y, z components of an element in "rnum" are used to generate new coordinates whereas w is for decision(acceptance or rejection) in each trial. The computational cost of random number generations can be effectively masked by MC cycles carried out on GPU. This is due to the fact that during the GPU performing a MC cycle, the random numbers for the next MC cycle can be generated simultaneously on CPU supported by concurrent execution between CPU and GPU in CUDA. We use CUDA's built-in function "cudaMemcpy" to upload the random numbers to the device. Function "cudaMemcpy" contains an intrinsic synchronization so that the system copies data only after the previous GPU job in the same stream finishes. Therefore there is no worry that the random number array changes while the GPU kernel is still using it.

16Data sampling and analysis can be either on the device or on the host. If we want to put some analysis tasks in CPU cores, we can download this array by built-in functions such as "cudaMemcpy" from device as well.

Decomposition

17When the host program invokes a kernel function of MC cycle, GPU constructs a one-dimensional grid with B thread blocks. Each thread block is one-dimensional and contains S = N/B threads. In the following text, we use a two-element tuple (bid, tid) to identify each thread, where bid shows which block the thread locates in and tid is the relative identity of this thread within the block bid.

18Similarly, the array of particles is divided into B groups, each with S particles. The trial of p'th particle in group g is assigned to the thread tid = p in block bid = g. In this article, we call the assigned particle the host-particle of corresponding thread. The mission of each thread is to compute the change of energy due to the trial of its host-particle and then decide the acceptance of the new move. At the beginning of kernel grid, each thread loads the information of its host-particle and random number vector from the global memory to its own registers. Then it computes the new position of its host-particle. The total energy change ∆E tid of the host-particle is stored as a double floating-point variable in thread's registers, which can be initialized with 0 or the change of its self-energy (if any). The pseudocode of initialization and the statements of symbols are shown in Algorithm 1.

Energy computation

19Despite the positions are represented by single floating-point data type, all the computations related to the energy should be performed by double floating-point operations. The reason is that the energy is a summation of billions of terms which can be either positive or negative in the charged system. Single float treatment in such summation amplifies the truncation error significantly.

20If there are hard core repulsions between particles, energy may be infinite. To avoid this problem, we can set an individual variable to indicate overlap. All the updating scheme of this indicator is similar to the computation of energy. In the CPU-based sequential program, when the overlap is encountered, we can stop the energy computation and reject the trial directly. This pre-rejection strategy can improve the speed of simulation on CPU, especially in the high volume fraction system. However, this is not a GPU-friendly strategy, due to the fact that this strategy leads to a long divergence path among different MC trials, which offends the SIMD computing scheme of GPU [45] and degrades the parallel efficiency. In this work, we do not use the pre-rejection strategy for two reasons. Firstly, the purpose of this work is to give a general framework on how to parallelize the Metropolis Monte Carlo simulation, where the hard-core repulsion is just a specific choice to deal with the short-range interaction. Secondly, in almost all the systems we study in this work, the volume fraction of particles is low, so that the pre-rejection doesn't make significant reduction of the computation, and the probability that all threads within a warp be pre-rejected is very low. As a result, the naive pre-rejection strategy on the GPU implementation cannot improve the performance. if the corresponding block terminated and the coordinates of it's host particle group updated. Require: X: a float4 vector whose x,y,z components are old coordinates of the host-particle and w component is the valence Require: X : a float4 vector whose x,y,z components are new coordinates of the host-particle and w is the random number for decision Require: Y : a f loat4 array with B elements on the shared memory, which stores the coordinates of guest particles Require: λ: Bjerrum length

Intergroup Calculation

21When threads in a block compute interactions with group J where J = bid (particles in J are called the guest particles and J is called the guest group), they perform a brush-like operation which is widely used in MD implementation [9]. Threads in this block firstly load the information of J from the global memory to an S-element float4 array Y on the shared memory. This loading procedure is one-to-one and aligned, so that we can enhance the cache hit rate and reduce the transaction of global memory.

22After group J loaded (here a synchronize instruction " syncthreads" is taken to ensure that all the threads in this block finish loading data of guest-group J), all threads within this thread block take a loop to calculate the change of pairwise interactions and add them up, as showed in Fig. 3.

23To avoid the bank conflict and take advantage of broadcasting feature of shared memory, all the loops in this block start at the same index. In this way, threads in the same warp access the same address simultaneously so that the shared memory can broadcast data. We choose 64-bit mode to make full use of the band-width of the shared memory.

24At last, the block synchronize instruction " syncthreads" is taken again to ensure that all threads finish processing the group J before the next group are loaded. Fig. 3 is the schematic illustration of this part. The pseudo-code of this part is shown in algorithm 2.

Self Calculation

25When thread block computes the interactions within its host-group, the procedure involves two main tasks of computations: (1). Compute the upper triangle parts in Fig.4. (2). Decide the trial and calculate the lower triangle parts as in Fig.5. Here we describe the details of these two tasks respectively.

Upper triangle part

26The upper triangle of the self-interaction table is independent of any other tasks. Therefore we can pre-calculate them by the brush scheme as before. Thread Each element stands for a pairwise energy change of corresponding particle pairs. The dashed arrows show the direction of loop for summation. Threads in block I compute and accumulate these pairwise interactions along horizontal direction in sequential order, whereas the energy change on each particle in group I is evaluated in parallel. tid = p computes the change of energy with particles p + 1, p + 2, ..., S − 1 in the host-group. To ensure threads within a warp accessing the same address, the for-loop of each thread should start at tid/w × w + 1. Here w is the size of a warp. In most GPU, w = 32. Fig. 4 is an illustration of this procedure. The pseudo-code for this part is shown in algorithm 3. In the first w loops, half of the threads on average within a warp are inactive. To reach the full warp efficiency we can use the map algorithm [37,38,39]. But this strategy increases usage of registers per thread that limits the number of concurrently executed blocks in one streaming multiprocessor(SMX) and thus decreases the SMX's efficiency. On the other hand, the computation of the first w loops is light compared with the whole tasks. So we do not implement this strategy in our code for Tesla K20.

Decision and lower triangle part

27The computation of the lower triangle part of the self-interaction table, together with decision of the trial in the host-group, should be performed at last. As shown in Fig. 5, when thread 0 finishes all the summations for ∆E 0 , it can make a decision by comparing with the random number X .w under acceptance ratio min{1, exp(−β∆E 0 )}. If X .w< min{1, exp(−β∆E 0 )}, thread 0 replaces x 0 by x 0 on the shared memory. Otherwise no coordinate update will be made. After thread 0 updates the coordinate of 0'th particle, the remaining threads tid > 0 in this block calculate the interactions with the 0'th particle together, and add the results to their own ∆E tid . Then thread 1 updates the coordinate of particle 1 and the updated energy of particle 1 is propogated to the other threads. This procedure is repeated for other threads until all the host-particles in this block are updated.

28The last step is to copy the information array of the host-particles from the shared memory to the global memory and set the corresponding flag "BlockState" to be one. The "BlockState" is an array with B elements, each of which indicates the state of corresponding block. Initially all the elements in this array is 0. When a thread block has written the updated coordinates of its host-particles to the global memory, the corresponding flag BlockState[bid] is set to 1. Since CUDA is a weak order programming language, the writing instruction for coordinates and the setting instruction for "BlockState" should be seperated by a "syncthreads"or a "threadfence" instruction to ensure the required executing order viewed in other blocks. The pseudo-code for this part is shown in algorithm 4. Fig. 6 shows the global procedure of a thread block. After initialization, threads in this block firstly compute the inter-group interactions with groups bid + 1,bid + 2,. . . , B − 1. Then they compute the internal upper-triangle interactions.

Global procedure

29The second global loop is to evaluate the interactions with groups 0,1,..,bid − 1. In serial implementation, particles in these groups are updated before the hostparticles. To realize this dependency in the GPU implementation, before loading information of a guest-group J, J < bid, all threads in this block should wait until the coordinates of particles in guest-group J are updated. Therefore, in each step J of this loop, one of the threads in this block firstly runs a subloop to check and wait until BlockState[J] is 1. Finally, threads make the decisions and evaluate the lower-triangle part of self-interaction table.

30A remaining issue is to reinitialize the flag-array to 0s for the next grid. We syncthreads(); Thread 0 do: Set BlockState[bid] to be 1 assign this additional work to block B − 1, which is the last one to terminate. Threads in it set all the elements of "BlockState" to 0s so that the next grid can use these indicators directly. The pseudocode for the global procedure is shown in algorithm 5.

31The above inter-block communications via flags are blocked communications since receivers will not carry out follow-up tasks until receiving the required messages. In a parallel program with blocked communication, we always need to avoid a deadlock state where receivers are waiting for each other and cannot terminate without external force. A case of deadlock in GPU is that all the resident blocks in SMXs are waiting for a message from a block which is not executed yet. In this case, the inactive sender block cannot move forward until one of the resident blocks terminates so that there is enough space to launch this sender block. Therefore, the resident blocks and the inactive sender blocks are waiting for each others. In our implementation, deadlock can be fortunately avoided because each thread block receives messages only from its previous blocks.

Multi-Thread-Per-Particle Treatment

32In above algorithm, one thread is responsible for one particle's trial. This one-thread-per-particle assignment cannot take full use of device if the number of particles is small because insufficient number of threads are carried out simultaneously to fully take advantage of the capability of GPU. To deal with small system, we take a multi-thread-per-particle assignment, in which the change of energy due to the trial of one particle is evaluated by two or more adjacent threads. In a program with η-thread-per-particle scheme, the size of thread block is η times of the group size. The energy change of the host particle k (k is the relative index within its group) will be computed by a bundle of threads tid = ηk, tid = ηk, ..., tid = η(k + 1) − 1, with interleaved loops as show in Fig. 7. This interleaved approach is performed in the inter-group evaluation and upper triangle part of self-table. Before the decisions and evaluation of the lower triangle part of self-table, we use warp-reductions to sum up results in all the slave threads of a particle to one. For convenience, η is selected to be 2, 4, 8 and 16, leading 1-step, 2-step, 3-step and 4-step warp shuffle instructions in the reductions.

Benchmark

33We benchmark the performance of our Brush Metropolis Algorithm on GPU by simulating the primitive model of electrolyte with various numbers of particles, and make a comparison with two other MC implementations: a sequential CPU code and a GPU code with parallel reduction scheme.

34In the CPU code, the evaluation and summation of the pairwise interactions are performed sequentially without using any acceleration methods. In the GPU code with parallel reduction scheme, each kernel tries to move one particle. There are N −1 pairwise interactions per trial to be calculated and summed, between the selected particle and the rest of particles in the system. We distribute these N − 1 evaluation to N threads while the thread for the selected particle remains idle. In this reduction kernel, the size of thread block is 1,024, which is the maximum number of threads per block in Tesla K20. The reduction within one block is done by warp shuffle instructions [46], which is an optimized version of parallel reduction [47] for Tesla K20. The intermediate results of warp sums are stored in the shared memory temporarily. We perform warp reduction again with these intermediate results so that the partial sums in this block are integrated. The sub-total of each block is to be added into the global memory atomically. When a block finishes adding the sub-total to the global memory, it should increase a global counter by 1 atomically. This global counter indicates the number of completed thread blocks. Finally, the last block decides acceptance of the proposed particle move. Before the last block updates the coordinate of the selected particle, one of threads in the last block checks this global counter ceaselessly until it indicates completion of summation. This method is straightforward and easy to implement, but it has some drawbacks that limit its performance. Firstly, in the parallel reduction there is a great thread divergency. For a reduction within warp(32 threads), the mean number of active threads is only (32 + 16 + 8 + 4 + 2 + 1)/6 ≈ 10.5, which means about 2/3 of computational resources are idle. Secondly, each time when the kernel is invoked, the system needs to take some time to initialize the environment. In this naive method program invokes kernel for N times in a cycle (N is the number of particles) whereas our Brush Metropolis method just invokes kernel once per cycle. Thus this naive method accumulates a considerable time for initialization. Finally, in each time when the kernel is invoked, the information of particles needs to be reloaded, leading to many global memory transactions and thus low cache efficiency.

35For the Brush Metropolis GPU code, we mainly measure the performance of one-thread-per-particle approach, with number of particles from 8, 192 up to 1, 048, 576. In addition, we carry out benchmarks of multi-thread-per-particle approach with number of particles from 8, 192 to 32, 768. We find that the size of block 1, 024 exhibits best performance. However, for the multi-thread-per-particle implementation, the number of slave threads per particle η with best performance changes with the size of system. We measure the execution time for 4 small systems, and find the best η for each system, as shown in Table. We carry out all benchmarks on a Linux machine with 2×8 Intel Xeon E5-2630

36(2.3GHz) CPU cores and two NVIDIA Tesla K20 GPUs. The operating system is Ubuntu 14.04, with the host C-code compiler GCC 4.8.4 and the GPU code compiler CUDA 7.0. The GPU driver's version is 346.96. The Monte Carlo simulation program on CPU is compiled with optimization option -O3. Both GPU codes are compiled with option -arch=sm 35. Since the GPU implementation of the Brush Metropolis method costs lots of registers, we take option -maxrregcount=65 as the register usage per thread to yield the best performance. The execution time in log-scale for all three algorithms is showed in Fig.8. It clearly shows that the time complexity of the Brush Metropolis Algorithm with one-thread-per-particle assignment is between the step complexity O(N ) and the work complexity O(N 2 ). (The step complexity measures the computational complexity assigned to each thread, including the cost of synchronization.) For particle number less than 50, 000, the time complexity scales approximately linearly with the step complexity. For even larger particle numbers, the workload of device is nearly saturated so that the time complexity scales with the work complexity. The GPU implementation with parallel reduction has a time complexity between O(N logN ) and O (N 2 ).

37The speedup of the Brush Metropolis GPU code (comparing with the CPU Figure 9: Speedup of the Brush Metropolis GPU code and the convention GPU code using parallel reduction. Figure 10: Performance comparison between GPU implementations based on parallel reduction and Brush Metropolis on a system with 131,072 particles. Performance data obtained from nvprof. Due to significantly higher L2 cache efficiency, our GPU implementation has better floating point throughput than that of parallel reduction implementation.

38code) as a function of system size is showed in Fig.9. For large systems the implementation with one-thread-per-particle saturates to approximately 440. In general the Brush Metropolis method exhibits significantly better speedup than the implementation with parallel reduction method, because of less global memory transactions and higher L2 cache efficiency, as well as higher floating point throughput in comparison with parallel reduction method, as shown in Fig.10. The main factor that prevents us from achieving even higher floating point efficiency is the Metropolis-style acceptance and rejection, which generate a divergence path for each proposed move.

Simulation of Linear Response Properties of Dense Electrolytes

39In this section, we use our Brush Metropolis GPU code to carry out a large scale MC simulation of the primitive model electrolytes, which are modeled as charged hard spheres. In the experiment the system contains 1, 048, 576 ions, and more than a hundred of Debye length. Because of the huge amount of available data, we are able to measure all pair correlation functions up to extremely precision and very long scale. Using these correlation functions, we determine various renormalized parameters that characterize the linear response properties of the electrolyte, including renormalized valences of the constituent ions, the renormalized Debye length, and the renormalized dielectric constant. These results demonstrate unequivocally that the properties of system are beyond the classical Poisson-Boltzmann theory (PB). We emphasize that in order to compute precisely the long scale properties of electrolytes, it is essentially important to simulate very large system sizes without making any approximation in long scales. This is the main advantage of our GPU code, compared with methods using multipole expansions.

Charge renormalization in concentrated electrolytes

40The classical Poisson-Boltzmann theory (PB) [50] predicts that the mean potential around a fixed ion with charge Q is given by

41whereas the effective interaction, i.e., two-ion potential of mean force (PMF), between two ions Q 1 , Q 2 is

42In the above equations, κ is the bare inverse Debye length, which, according to PB, is related to bulk ion densitiesn ± and charges q ± via:

43Because the classical PB theory ignores correlation effects, it is not applicable in the concentrated regime. In this regime, the correct far field behaviors of mean potential and two-ion PMF are [48,49]:

44where Q R , Q R 1 , Q R 2 , κ R , R are, respectively, the renormalized charges, renormalized inverse Debye length, and renormalized dielectric constant, which are different from their bare values. There is an exact relation between the renormalized Debye length and renormalized charges of constituent ions:

45Eqs. (6)- (8) are the main results of the dressed-ion theory [48]. We shall compute renormalized valences of constituent ions, renormalized Debye length and renormalized dielectric constant, and finally verify the relation Eq. (8) using large-scale MC simulations.

Simulation Methodology

46To compute all renormalized parameters of dense electrolytes, we perform large scale simulations of electrolytes and measure all pair correlation functions. All our simulations are carried out in the Center for High Performance Computing (HPC) of Shanghai Jiaotong University. To fully take advantage of computation resources, we perform one individual simulation on each GPU card. The number of cards employed in simulation varies according to the ion densities. Typically one data point needs 2 GPU cards, each of which carries out about 2, 000 iterations with about 5 days. In particular, as the system approaches the charge oscillation regime (where ion densities are high), more Monte Carlo cycles are needed and thus more cards are used. For each simulation(MPI Process), the memory cost on host is 263MB, and the cost of global memory on GPU is about 32MB. The system contains 1, 024 × 1, 024 = 1, 048, 576 particles with room temperature T = 300K, and relative dielectric constant of the solvent is chosen to be = 78.3 and the Bjerrum length b = 7.117Å. We use a spherical simulation domain with hard wall boundary conditions. To eliminate influences from the boundary, ions that are less than ten Debye lengths away from the boundary are not used for data collection. The initial state is generated by setting particles uniformly inside the simulation domain with hard core repulsions. The proposed position of the selected particle is uniformly generated inside a cubic center around its original position with size about L/3 from experience, where L is the size of simulation domain. In the warming iterations we output the total energy to monitor whether the system equilibrates or not. We find that almost all the systems we study can equilibrate in about 10 cycles. Therefore we are sure that for all the systems the correlation between successive configurations is weak. In Fig. 11 we present a typical autocorrelation function of total energy for an equilibrated 3:-1 electrolyte with classical debye length 28.53Å, whose autocorrelation time is about 2.3. Here the autocorrelation function of total energy is defined as

47Here E k denotes the total energy at step k and E stands for the mean energy at equilibrium. The over-line can be performed by averaging variable over both ensemble (MPI procedures) and time (steps). The integrated autocorrelation time is defined as A typical pair correlation function is showed in Fig. 12. The renormalized parameters κ R , R , q R ± can be obtained from tails of pair correlation functions g ±± (r) as follows. Firstly the two-ion PMF are obtained via:

48Now, let us fix a positive/negative ion q + /q − at the origin in the bulk electrolyte. The average charge density (excluding the charge q ± fixed at the origin) can also be computed by: ρ q ± (r) = n + q + g +± (r) + n − q − g −± (r).

49Now the mean potential φ ± (r) around the fixed ion is given by Eq. (6) with Q R replaced by q R ± in the far field. The mean charge density ρ q ± (r) can be obtained using the exact Poisson equation. In the far field, they decay in the form of screened Coulomb potential:

50We can take the logarithm of Eq. (13) and obtain: We can therefore plot the l.h.s. (measured by simulations) as a function of radius r, fit the data to straight-lines in the far field, and extract the renormalized inverse Debye length κ R from their slopes. This is illustrated in Fig. (13). Note that two straight-lines have the same slope and give a renormalized Debye length κ −1 R = 25.57Å, manifestly different from the bare Debye length κ −1 = 28.53Å.

51According to Eq. (7), the far field asymptotics of the two-ion PMF is

52Taking the ratio of Eqs. (13) and (15), we find the following relation valid in the far field:

53Since all quantities in the r.h.s. are known, we can use this relation to determine the renormalized charges q R ± of positive and negative ions. In fact we have two independent ways to compute the renormalized charges. Let us write them out explicitly:

54The data for one particular simulation are shown in Fig. 14, from which we extract the renormalized charges of positive and negative ions to be 4.125 and -0.884 re-spectively. Note that these are substantially different from the bare charges, which are 3 and -1 respectively. This charge renormalization arises as a consequence of ionic correlations and signify the failure of the classical PB theory. Using Eq. (13) we can compute the renormalized dielectric constant R in terms of κ R , q R ± , and ρ q ± (r) (again in two independent ways):

55Finally, we also use the computed κ R and q R ± to test the validity of the exact relation Eq. (8). The results are displayed in Fig. 15(a). Additionally, we plot q R ± and κ R in Figs. 15(b) and 15(c) respectively measured in two independent ways and show that they are consistent with each other, within computational errors. All these numerical tests unambiguously demonstrate the validity and internal consistency of the dressed-ion theory, Eqs. (6)-(8). Figure 14: Plotting βU v.s. ρ q /e for 3:-1 electrolyte. The radius of ions is 3.75Å and the classical debye length is 28.53Å. Using Eq. (17) and fitting the long rang data to straight-lines, we obtain the renormalized valences of the positive ion and of the negative ions to be 4.125 and -0.884 respectively, which are different from the bare valences 3 and -1 respectively. This again demonstrates the failure of classical PB theory.

Conclusion

56In this work, we have developed an efficient GPU code for large-scale Monte Carlo simulation of Coulomb many-body systems, which parallelizes the sequential 2: 1, d 7. The renormalized valences of ions, computed using in two independent ways, see Eqs. (17). The purpose of this panel is to demonstrate that two independent computations give the same result, within computational errors. (c): Renormalized dielectric constant can also be computed in two ways, see (18). The fact that these renormalized parameters are different from their bare values demonstrates that the properties of concentrated electrolytes are beyond the classical Poisson-Boltzmann theory.

57updating scheme and achieves an acceleration of 440 over the sequential CPU code, without sacrificing accuracy. We have further applied this method to precisely measure the long scale linear response properties of dense asymmetric electrolytes and have demonstrated that they are beyond the classical Poisson-Boltzmann theory.

참고문헌 51건

  1. Porting LAMMPS to GPUs. 2010
  2. Electrostatic Properties of Membranes: The Poisson-Boltzmann Theory Handbook of biological physics · Elsevier BV · 1995 10.1016/s1383-8121(06)80005-9
  3. The Chamomile Scheme: An Optimized Algorithm for N-body simulations on Programmable Graphics Processing Units New Astronomy · Elsevier BV · 2007
  4. A load-balancing workload distribution scheme for three-body interaction computation on Graphics Processing Units (GPU) Journal of Parallel and Distributed Computing · Elsevier BV · 2015 10.1016/j.jpdc.2015.10.003
  5. Structural, dynamic, and electrostatic properties of fully hydrated DMPC bilayers from molecular dynamics simulations accelerated with graphical processing units (GPUs) Journal of Computational Chemistry · Wiley · 2011 10.1002/jcc.21871
  6. An exact but linear and Poisson—Boltzmann-like theory for electrolytes and colloid dispersions in the primitive model Chemical Physics Letters · Elsevier BV · 1992 10.1016/0009-2614(92)87048-t
  7. Accelerating molecular dynamics simulations using Graphics Processing Units with CUDA Computer Physics Communications · Elsevier BV · 2008 10.1016/j.cpc.2008.05.008
  8. Routine Microsecond Molecular Dynamics Simulations with AMBER on GPUs. 1. Generalized Born Journal of Chemical Theory and Computation · American Chemical Society · 2012 10.1021/ct200909j
  9. Pseudo-random number generation for Brownian Dynamics and Dissipative Particle Dynamics simulations on GPU devices Journal of Computational Physics · Elsevier BV · 2011 10.1016/j.jcp.2011.05.021
  10. Accelerating knowledge-based energy evaluation in protein structure modeling with Graphics Processing Units Journal of Parallel and Distributed Computing · Elsevier BV · 2011 10.1016/j.jpdc.2011.10.005
  11. Dressed-ion theory for electrolyte solutions: A Debye–Hückel-like reformulation of the exact theory for the primitive model The Journal of Chemical Physics · American Institute of Physics · 1994 10.1063/1.468116
  12. An Efficient Program for Many-Body Simulation SIAM Journal on Scientific and Statistical Computing · Society for Industrial and Applied Mathematics · 1985 10.1137/0906008
  13. GPU accelerated molecular dynamics simulation of thermal conductivities Journal of Computational Physics · Elsevier BV · 2006 10.1016/j.jcp.2006.06.039
  14. Parallel Monte Carlo simulation in the canonical ensemble on the graphics processing unit International Journal of Parallel Emergent and Distributed Systems · Taylor & Francis · 2013 10.1080/17445760.2013.833617
  15. Highly accelerated simulations of glassy dynamics using GPUs: Caveats on limited floating-point precision Computer Physics Communications · Elsevier BV · 2011 10.1016/j.cpc.2011.01.009
  16. High-Throughput Characterization of Porous Materials Using Graphics Processing Units Journal of Chemical Theory and Computation · American Chemical Society · 2012 10.1021/ct200787v
  17. GPU-accelerated Gibbs ensemble Monte Carlo simulations of Lennard-Jonesium Computer Physics Communications · Elsevier BV · 2013 10.1016/j.cpc.2013.06.020
  18. A hierarchical O(N log N) force-calculation algorithm Nature · Nature Portfolio · 1986 10.1038/324446a0
  19. General purpose molecular dynamics simulations fully implemented on graphics processing units Journal of Computational Physics · Elsevier BV · 2008 10.1016/j.jcp.2008.01.047
  20. Efficient nonbonded interactions for molecular dynamics on a graphics processing unit Journal of Computational Chemistry · Wiley · 2009 10.1002/jcc.21413
  21. Rigid body constraints realized in massively-parallel molecular dynamics on graphics processing units Computer Physics Communications · Elsevier BV · 2011 10.1016/j.cpc.2011.06.005
  22. An image-based reaction field method for electrostatic interactions in molecular dynamics simulations of aqueous solutions The Journal of Chemical Physics · American Institute of Physics · 2009 10.1063/1.3245232
  23. Mellin Transform and Image Charge Method for Dielectric Sphere in an Electrolyte SIAM Journal on Applied Mathematics · Society for Industrial and Applied Mathematics · 2013 10.1137/120894348
  24. A fast algorithm for particle simulations Journal of Computational Physics · Elsevier BV · 1987 10.1016/0021-9991(87)90140-9
  25. GPU-Enabled Macromolecular Simulation: Challenges and Opportunities Computing in Science & Engineering · AIP Publishing · 2012 10.1109/mcse.2012.42
  26. Efficient Monte Carlo Simulations of Gas Molecules Inside Porous Materials Journal of Chemical Theory and Computation · American Chemical Society · 2012 10.1021/ct3003699
  27. An overview of the Amber biomolecular simulation package Wiley Interdisciplinary Reviews Computational Molecular Science · Wiley · 2012 10.1002/wcms.1121
  28. Gravitational tree-code on graphics processing units: implementation in CUDA Procedia Computer Science · Elsevier BV · 2010 10.1016/j.procs.2010.04.124
  29. Multi-GPU accelerated multi-spin Monte Carlo simulations of the 2D Ising model Computer Physics Communications · Elsevier BV · 2010 10.1016/j.cpc.2010.05.005
  30. Massively parallel Monte Carlo for many-particle simulations on GPUs Journal of Computational Physics · Elsevier BV · 2013 10.1016/j.jcp.2013.07.023
  31. SPFP: Speed without compromise—A mixed precision model for GPU accelerated molecular dynamics simulations Computer Physics Communications · Elsevier BV · 2012 10.1016/j.cpc.2012.09.022
  32. GPU accelerated Monte Carlo simulation of the 2D and 3D Ising model Journal of Computational Physics · Elsevier BV · 2009 10.1016/j.jcp.2009.03.018
  33. Molecular Monte Carlo Simulations Using Graphics Processing Units: To Waste Recycle or Not? Journal of Chemical Theory and Computation · American Chemical Society · 2011 10.1021/ct200474j
  34. C programming guide 1983
  35. Enhanced molecular dynamics performance with a programmable graphics processor Computer Physics Communications · Elsevier BV · 2010 10.1016/j.cpc.2010.12.029
  36. Accelerated floating random walk algorithm for the electrostatic computation with 3-D rectilinear-shaped conductors Simulation Modelling Practice and Theory · Elsevier BV · 2013 10.1016/j.simpat.2013.01.003
  37. Simulating Lattice Spin Models on Graphics Processing Units Journal of Chemical Theory and Computation · American Chemical Society · 2010 10.1021/ct100385b
  38. Accelerating molecular modeling applications with graphics processors Journal of Computational Chemistry · Wiley · 2007 10.1002/jcc.20829
  39. Adapting a message-driven parallel application to GPU-accelerated clusters IEEE International Conference on High Performance Computing, Data, and Analytics · 2008 10.5555/1413370.1413379
  40. Implementing molecular dynamics on hybrid high performance computers – short range forces Computer Physics Communications · Elsevier BV · 2010 10.1016/j.cpc.2010.12.021
  41. Charge Renormalization and Charge Oscillation in Asymmetric Primitive Model of Electrolytes Journal of Statistical Physics · Springer Science+Business Media · 2016 10.1007/s10955-016-1644-3
  42. Routine Microsecond Molecular Dynamics Simulations with AMBER on GPUs. 2. Explicit Solvent Particle Mesh Ewald Journal of Chemical Theory and Computation · American Chemical Society · 2013 10.1021/ct400314y
  43. Savitzky-Golay Smoothing Filters Computers in Physics · American Institute of Physics · 1990 10.1063/1.4822961
  44. 2014 International Conference on Computational Science Procedia Computer Science · Elsevier BV · 2014
  45. The Chamomile Scheme: An Optimized Algorithm for N-body simulations on\n Programmable Graphics Processing Units arXiv (Cornell University) · Cornell University · 2007 10.48550/arxiv.astro-ph/0703100
  46. A multi-scale Monte Carlo method for electrolytes New Journal of Physics · IOP Publishing · 2015 10.1088/1367-2630/17/8/083062
  47. Efficient implementation of the Barnes-Hut octree algorithm for Monte Carlo simulations of charged systems Science China Mathematics · Springer Nature · 2014 10.1007/s11425-014-4783-5
  48. Charge Renormalization and Charge Oscillation in Asymmetric Primitive Model of Electrolytes Journal of Statistical Physics · Springer Science+Business Media · 2016 10.1007/s10955-016-1644-3
  49. A Hierarchical (N) Force Calculation Algorithm Journal of Computational Physics · Elsevier BV · 2002 10.1006/jcph.2002.7026
  50. Adapting a message-driven parallel application to GPU-accelerated clusters 2008 10.1109/sc.2008.5214716
  51. Proceedings of the 2007 ACM/IEEE conference on Supercomputing 2007 10.1145/1362622