mdrunner函数在runner.c和runner_openmm.c中均有,是MD模拟的主要程序之一。但是对另一个do_md函数的调用一直是个谜,今天终于看出了点头绪。

这里以runner.c中的mdrunner作为例子:

先看一个Interator的定义,在这里我们发现了do_md的影子。

Interator有积分器,综合者的意思

/* The array should match theeI array in include/types/enums.h */

const gmx_intp_t  Interator[eiNR] = { {do_md},{do_steep}, {do_cg}, {do_md}, {do_md}, {do_nm}, {do_lbfgs}, {do_tpi}, {do_tpi},{do_md}, {do_md}, {do_md}};

就好奇gmx_intp_t是什么类型的结构,看一下:

typedef struct {

gmx_integrator_t *func;

} gmx_intp_t;

位置就在其定义上面,然后看下gmx_integrator_t的定义:

typedef doublegmx_integrator_t (FILE *log, t_commrec *cr,

int nfile,const t_filenm fnm[],

const output_env_toenv, gmx_bool bVerbose,

gmx_boolbCompact, int nstglobalcomm,

gmx_vsite_t*vsite, gmx_constr_t constr,

int stepout,

t_inputrec*inputrec,

gmx_mtop_t*mtop, t_fcdata *fcd,

t_state*state,

t_mdatoms*mdatoms,

t_nrnb *nrnb, gmx_wallcycle_t wcycle,

gmx_edsam_ted,

t_forcerec*fr,

intrepl_ex_nst, int repl_ex_nex, int repl_ex_seed,

gmx_membed_t membed,

realcpt_period, real max_hours,

const char*deviceOptions,

unsigned longFlags,

gmx_runtime_t*runtime);

原来是一个方法的typedef声明,那integrator就是eiNR个包含gmx_integrator_t函数的gmx_intp_t结构体数组。有点绕。

通过integrator定义前面的注释,我们找到了eiNR在enums.h中的定义

enum {

eiMD, eiSteep, eiCG, eiBD,eiSD2, eiNM, eiLBFGS, eiTPI, eiTPIC, eiSD1, eiVV, eiVVAK, eiNR

};

但是不理解里面说的match是怎么match的。

下一次对主要嫌疑人的integrator见面在这:

if (integrator[inputrec->eI].func ==do_md)

{

/* Turn on signal handling on all nodes*/

/*

* (A user signal from the PME nodes(if any)

* is communicated to the PP nodes.

*/

signal_handler_install();

}

这里好像注册了一个信号,具体是干什么的,还未知。

然后就是:

/* Now do whatever the userwants us to do (how flexible...) */

integrator[inputrec->eI].func(fplog,cr, nfile, fnm,

oenv,bVerbose, bCompact,

nstglobalcomm,

vsite,constr,

nstepout,inputrec, mtop,

fcd,state,

mdatoms,nrnb, wcycle, ed, fr,

repl_ex_nst, repl_ex_nex, repl_ex_seed,

membed,

cpt_period, max_hours,

deviceOptions,

Flags,

&runtime);

呵呵,找到函数调用了,看一下。首先看看inputrec->eI:

t_inputrec     *inputrec;                                 //mdrunner函数中的变量

//结构定义

typedef struct {

int             eI;                   /* Integration method                 */

gmx_large_int_t nsteps;               /* number of steps to be taken                   */

int             simulation_part;      /* Used in checkpointing to separatechunks */

gmx_large_int_t init_step;            /* start at a stepcount >0 (usedw. tpbconv)    */

int             nstcalcenergy;        /* frequency of energy calc. and T/Pcoupl. upd.       */

int             cutoff_scheme;        /* group or verlet cutoffs     */

int             ns_type;              /* which ns method should weuse?               */

int             nstlist;              /* number of steps beforepairlist is generated         */

int             ndelta;               /* number of cells per rlong                       */

int             nstcomm;              /* number of steps after which center of mass   */

/* motion is removed                                   */

int             comm_mode;            /* Center of mass motion removalalgorithm      */

int             nstcheckpoint;        /* checkpointing frequency                      */

int             nstlog;               /* number of steps after whichprint to logfile         */

int             nstxout;              /* number of steps after which Xis output     */

int             nstvout;              /* id. for V                                              */

int             nstfout;              /* id. for F                                      */

int             nstenergy;            /* number of steps after whichenergies printed */

int             nstxtcout;            /* id. for compressed trj (.xtc)           */

double          init_t;               /* initial time (ps)              */

double          delta_t;              /* time step (ps)                                   */

real            xtcprec;              /* precision of xtc file                        */

real            fourier_spacing;      /*requested fourier_spacing, when nk? not set */

int             nkx, nky, nkz;        /* number of k vectors in each spatialdimension*/

/*for fourier methods for long range electrost.*/

int             pme_order;            /* interpolation order for PME                  */

real            ewald_rtol;           /* Real space tolerance for Ewald,determines   */

/*the real/reciprocal space relative weight   */

int             ewald_geometry;       /* normal/3d ewald, or pseudo-2d LRcorrections */

real            epsilon_surface;      /* Epsilon for PME dipole correction            */

gmx_bool        bOptFFT;              /* optimize the fft plan atstart               */

int             ePBC;                 /* Type of periodic boundaryconditions                  */

int             bPeriodicMols;        /* Periodic molecules                           */

gmx_bool        bContinuation;        /* Continuation run: starting state iscorrect */

int             etc;                  /* temperature coupling               */

int             nsttcouple;           /* interval in steps for temperaturecoupling   */

gmx_bool        bPrintNHChains;       /*whether to print nose-hoover chains       */

int             epc;                  /* pressure coupling                            */

int             epct;                 /* pressure coupling type                          */

int             nstpcouple;           /* interval in steps for pressurecoupling      */

real            tau_p;                /* pressure coupling time (ps)                           */

tensor          ref_p;                /* reference pressure (kJ/(molnm^3))            */

tensor          compress;             /* compressability ((mol nm^3)/kJ)        */

int             refcoord_scaling;     /* How to scale absolute referencecoordinates  */

rvec            posres_com;           /* The COM of the posres atoms                  */

rvec            posres_comB;          /* The B-state COM of the posresatoms          */

int             andersen_seed;        /* Random seed for Andersen thermostat(obsolete) */

real            verletbuf_drift;      /* Max. drift (kJ/mol/ps/atom) for listbuffer  */

real            rlist;                /* short range pairlist cut-off(nm)             */

real            rlistlong;            /* long range pairlist cut-off (nm)                 */

int             nstcalclr;            /* Frequency of evaluating directspace long-range interactions */

real            rtpi;                 /* Radius for test particleinsertion           */

int             coulombtype;          /* Type of electrostaticstreatment             */

int             coulomb_modifier;     /* Modify the Coulomb interaction              */

real            rcoulomb_switch;      /* Coulomb switch range start (nm)                  */

real            rcoulomb;             /* Coulomb cutoff (nm)                            */

real            epsilon_r;            /* relative dielectricconstant                 */

real            epsilon_rf;           /* relative dielectric constant ofthe RF       */

int             implicit_solvent;     /* No (=explicit water), or GBSA solventmodels */

int             gb_algorithm;         /* Algorithm to use for calculationBorn radii  */

int             nstgbradii;           /* Frequency of updating GeneralizedBorn radii */

real            rgbradii;             /* Cutoff for GB radiicalculation              */

real            gb_saltconc;          /* Salt concentration (M) for GBSAmodels       */

real            gb_epsilon_solvent;   /* dielectric coeff. of implicitsolvent     */

real            gb_obc_alpha;         /* 1st scaling factor for Bashford-CaseGB      */

real            gb_obc_beta;          /* 2nd scaling factor forBashford-Case GB      */

real            gb_obc_gamma;         /* 3rd scaling factor forBashford-Case GB      */

real            gb_dielectric_offset; /* Dielectricoffset for Still/HCT/OBC     */

int             sa_algorithm;         /* Algorithm for SA part of GBSA                */

real            sa_surface_tension;   /* Energy factor for SA part of GBSA */

int             vdwtype;              /* Type of Van der Waalstreatment              */

int             vdw_modifier;         /* Modify the VdW interaction                   */

real            rvdw_switch;          /* Van der Waals switch range start(nm)        */

real            rvdw;                 /* Van der Waals cutoff (nm)        */

int             eDispCorr;            /* Perform Long range dispersioncorrections    */

real            tabext;               /* Extension of the table beyondthe cut-off,   *

* as well asthe table length for 1-4 interac. */

real            shake_tol;            /* tolerance for shake                                  */

int             efep;                 /* free energycalculations                     */

t_lambda       *fepvals;              /* Data for the FEP state                       */

gmx_bool        bSimTemp;             /* Whether to do simulatedtempering            */

t_simtemp      *simtempvals;          /* Variables for simulated tempering            */

gmx_bool        bExpanded;            /* Whether expanded ensembles areused          */

t_expanded     *expandedvals;         /* Expanded ensemble parameters              */

int             eDisre;               /* Type of distancerestraining                 */

real            dr_fc;                /* force constant for ta_disre                    */

int             eDisreWeighting;      /* type of weighting of pairs in onerestraints */

gmx_bool        bDisreMixed;          /* Use comb of time averaged andinstan. viol's   */

int             nstdisreout;          /* frequency of writing pairdistances to enx   */

real            dr_tau;               /* time constant for memoryfunction in disres    */

real            orires_fc;            /* force constant for orientationalrestraints  */

real            orires_tau;           /* time constant for memory functionin orires    */

int             nstorireout;          /* frequency of writing tr(SD) toenx           */

real            dihre_fc;             /* force constant for dihedralrestraints (obsolete) */

real            em_stepsize;          /* The stepsize for updating                      */

real            em_tol;               /* The tolerance                                 */

int            niter;                /* Number of iterations forconvergence of      */

/*steepest descent in relax_shells            */

real            fc_stepsize;          /* Stepsize for directionalminimization        */

/* inrelax_shells                             */

int             nstcgsteep;           /* number of steps after which asteepest       */

/*descents step is done while doing cg        */

int             nbfgscorr;            /* Number of corrections to thehessian to keep */

int             eConstrAlg;           /* Type of constraint algorithm                 */

int             nProjOrder;           /* Order of the LINCS ProjectionAlgorithm      */

real            LincsWarnAngle;       /* If bond rotates more than %g degrees,warn   */

int             nLincsIter;           /* Number of iterations in the finalLincs step */

gmx_bool       bShakeSOR;            /* Use successive overrelaxationfor shake      */

real            bd_fric;              /* Friction coefficient for BD(amu/ps)         */

int             ld_seed;              /* Random seed for SD and BD                    */

int             nwall;                /* The number of walls                          */

int             wall_type;            /* The type of walls                            */

real            wall_r_linpot;        /* The potentail is linear forr<=wall_r_linpot */

int             wall_atomtype[2];     /* The atom type for walls                      */

real            wall_density[2];      /* Number density for walls                     */

real            wall_ewald_zfac;      /*Scaling factor for the box for Ewald        */

int             ePull;                /* Type of pulling: no,umbrella or constraint  */

t_pull         *pull;                 /* The data for center of masspulling          */

gmx_bool        bRot;                 /* Calculate enforced rotationpotential(s)?    */

t_rot          *rot;                  /* The data for enforcedrotation potentials    */

real            cos_accel;            /* Acceleration for viscositycalculation       */

tensor          deform;               /* Triclinic deformationvelocities (nm/ps)     */

int             userint1;             /* User determined parameters                   */

int             userint2;

int             userint3;

int             userint4;

real            userreal1;

real            userreal2;

real            userreal3;

real            userreal4;

t_grpopts       opts;          /* Group options                               */

t_cosines       ex[DIM];       /* Electric field stuff       (spatial part)             */

t_cosines       et[DIM];       /* Electric field stuff       (time part)                 */

gmx_bool        bQMMM;         /* QM/MM calculation                            */

int             QMconstraints; /* constraints onQM bonds                      */

int             QMMMscheme;    /* Scheme: ONIOM or normal                      */

real            scalefactor;   /* factor for scaling the MM charges in QMcalc.*/

/* parameterneeded for AdResS simulation       */

gmx_bool        bAdress;       /* Is AdResS enabled ? */

t_adress       *adress;        /* The data for adress simulations */

} t_inputrec;

然后调用对应的func函数完成函数调用,但是还有一个疑问inputrec的初始化和值的标定在哪里?继续找

snew(inputrec, 1);这里是申请空间。

这里

* Read (nearly) all datarequired for the simulation */

read_tpx_state(ftp2fn(efTPX, nfile,fnm), inputrec, state, NULL, mtop);

看下t_filenm的定义:

typedef struct {

int           ftp;    /* File type (see enum above)          */

const char  *opt;    /* Command line option                     */

const char  *fn;     /* File name (as set insource code) */

unsigned long flag;   /* Flag for all kinds of info (see defs)*/

int           nfiles; /* number of files                           */

char       **fns;    /* File names                              */

} t_filenm;

总之是读取一个类型的文件,然后通过文件初始化。

通过Gromacs网站了解到调用的方法取决于mdp文件中的整型量。但是一般情况是调用的do_md方法。

Gromacs源码收获(四)相关推荐

  1. 【投屏】Scrcpy源码分析四(最终章 - Server篇)

    Scrcpy源码分析系列 [投屏]Scrcpy源码分析一(编译篇) [投屏]Scrcpy源码分析二(Client篇-连接阶段) [投屏]Scrcpy源码分析三(Client篇-投屏阶段) [投屏]Sc ...

  2. 一点一点看JDK源码(四)java.util.ArrayList 中篇

    一点一点看JDK源码(四)java.util.ArrayList 中篇 liuyuhang原创,未经允许禁止转载 本文举例使用的是JDK8的API 目录:一点一点看JDK源码(〇) 1.综述 在前篇中 ...

  3. mybatis源码阅读(四):mapper(dao)实例化

    转载自   mybatis源码阅读(四):mapper(dao)实例化 在开始分析之前,先来了解一下这个模块中的核心组件之间的关系,如图: 1.MapperRegistry&MapperPro ...

  4. 39 网络相关函数(七)——live555源码阅读(四)网络

    39 网络相关函数(七)--live555源码阅读(四)网络 39 网络相关函数(七)--live555源码阅读(四)网络 简介 14)readSocket从套接口读取数据 recv/recvfrom ...

  5. ABP源码分析四十七:ABP中的异常处理

    ABP源码分析四十七:ABP中的异常处理 参考文章: (1)ABP源码分析四十七:ABP中的异常处理 (2)https://www.cnblogs.com/1zhk/p/5538983.html (3 ...

  6. gSOAP 源码分析(四)

    gSOAP 源码分析(四) 2012-6-2 邵盛松 前言 本文主要说明gSOAP中对Client的认证分析 gSOAP中包含了HTTP基本认证,NTLM认证等,还可以自定义SOAP Heard实现认 ...

  7. hdl_graph_slam源码解读(四):关键帧

    目录 1. 整体介绍 2. 详细介绍 2.1 KeyFrame类 2.2 KeyFrameSnapshot类 2.3 KeyFrameUpdater类 参考文献 1. 整体介绍 在图优化中,关键帧的作 ...

  8. 深入SpringBoot源码(四)初识Environment

    深入SpringBoot源码(四)初识Environment new DefaultApplicationArguments prepareEnvironment getOrCreateEnviron ...

  9. Spring 源码分析(四) ——MVC(二)概述

    随时随地技术实战干货,获取项目源码.学习资料,请关注源代码社区公众号(ydmsq666) from:Spring 源码分析(四) --MVC(二)概述 - 水门-kay的个人页面 - OSCHINA ...

最新文章

  1. MySQL学习笔记之启动停止与登录,显示相关信息
  2. Eclipse插件安装方式及使用说明
  3. 在全局中调用类的静态成员函数
  4. Vue实现组件props双向绑定解决方案
  5. 《JAVA与模式》之观察者模式
  6. 跨域问题是怎样造成的
  7. 随想录(英语学习的几个误区)
  8. Linux清除用户登录记录和命令历史方法
  9. 14的虚拟机可以用在15上面吗_环氧底漆是什么漆,分很多种吗?环氧底漆都可以用在什么上面...
  10. 计算机网络—SR选择重传协议
  11. linux快速删除大文件rsync,(总结)Linux下使用rsync最快速删除海量文件的方法
  12. httpget和ajax,javascript - HTTP中的get、post请求和ajax的get、post请求是一个东西吗?...
  13. 读《微波工程(第三版)》笔记 (零:介绍)
  14. 如何下载百度文库文章
  15. Roblox、Epic Games和Meta,详解三巨头如何引爆元宇宙
  16. 关于Linux内核学习(经典)
  17. Java后端验证苹果登录
  18. docker安装包安装
  19. 电脑摄像头一会好使一会不好使
  20. iOS 二维码生成 (Swift代码)

热门文章

  1. 设计模式——单例模式(创建型模式)
  2. Shell/猛犸推送消息给钉钉机器人
  3. 基于matlab指纹识别论文,毕业论文-基于Matlab的指纹识别
  4. Whitelabel Error PageThis application has no explicit mapping for /error, so you are seeing this as
  5. 使用echartJs展示报表广东省地图+柱状图
  6. IT商界著名公司来历和简介
  7. matlab 手把手教你制作五子棋小游戏
  8. python3 23.keras使用交叉熵代价函数进行MNIST数据集简单分类 学习笔记
  9. 单片机学习笔记————组合BCD码,非组合BCD码,以及数值三者之间的相互转换和关系
  10. 怎么改变png图片的大小kb?怎么更改png图片的大小?