/* Molecular dynamics simulation linear code for binary Lennard-Jones liquid under NVE ensemble; Author: You-Liang Zhu, Email: youliangzhu@ciac.ac.cn Copyright: You-Liang Zhu This code is free: you can redistribute it and/or modify it under the terms of the GNU General Public License.*/ #include #include #include int main() { int nthreads; int threads_id; /* Fork a team of threads giving them their own copies of variables */ #pragma omp parallel num_threads(3) { /* Assign the loop into threads */ #pragma omp for for(int i=0; i<9; ++i) { nthreads = omp_get_num_threads(); /* Obtain the number of threads */ threads_id = omp_get_thread_num(); /* Obtain thread number */ printf("hello world, number of threads = %d, thread ID = %d, index= %d\n", nthreads, threads_id, i); } } return 0; }