The proper choice of collective variables (CVs) is central to biased-sampling free energy reconstruction methods in molecular dynamics simulations. The PLUMED 2 library, for instance, provides several sophisticated CV choices, implemented in a C++ framework; however, developing new CVs is still time consuming due to the need to provide code for the analytical derivatives of all functions with respect to atomic coordinates. We present two solutions to this problem, namely (a) symbolic differentiation and code generation, and (b) automatic code differentiation, in both cases leveraging open-source libraries (SymPy and Stan Math respectively). The two approaches are demonstrated and discussed in detail implementing a realistic example CV, the local radius of curvature of a polymer. Users may use the code as a template to streamline the implementation of their own CVs using high-level constructs and automatic gradient computation.
翻译:正确选择集体变量(CVs)对于在分子动态模拟中以偏向方式抽样免费能源重建方法至关重要。例如,PLUMED 2图书馆提供几种复杂的CV选择,在C+++框架内实施;然而,开发新的CV仍然耗费时间,因为需要为所有原子坐标功能的分析衍生物提供代码。我们提出了解决这一问题的两个解决方案,即:(a) 象征性差异和代码生成,和(b) 自动代码区分,在这两种情况下,利用开放源库(分别为SymPy和Stan Math),两种方法都得到了演示和详细讨论,以实施一个现实的CV,即聚合物的局部曲线半径。用户可以使用该代码作为模板,利用高层次的构造和自动梯度计算来简化自己的CV的实施。