Location>code7788 >text

Use SpongeExt to quickly complete the enhanced sampling of CudaSPONGE combined with PySAGES

Popularity:597 ℃/2025-01-23 10:16:37

Technical background

In some previous articles, we have introduced theInstallation and basic usage of CudaSPONGEPython interface provided by CudaSPONGEBasic usage of PySAGES enhanced sampling software, and another article aboutCombining CudaSPONGE and PySAGESarticles and made some simplePerformance test of CudaSPONGE combined with PySAGES. Because the interface between CudaSPONGE and PySAGES can actually be shared in multiple scenarios, consider encapsulating this part of the interface into a separate package so that users can use PySAGES in CudaSPONGE as effortlessly as possible.

Pip installation

The latest source code storage address of SpongeExt is:/dechin/sponge-ext/tree/master, are very simple Python codes, but have some prerequisites for the environment, such as Jax, Jaxlib, Cupy, etc. Of course, PySAGES must be installed first. Users can download the source code for compilation and installation, or they can install it directly using pip:

$ python3 -m pip install SpongeExt --upgrade

If no error is reported, the installation is successful.

How to use

existExample path of the open source repository, we have stored a complete demonstration case. Its directory structure is roughly as follows:

.
|-- 
|-- protein
|   |-- alad_LJ.txt
|   |-- alad_angle.txt
|   |-- alad_atom_name.txt
|   |-- alad_atom_type_name.txt
|   |-- alad_bond.txt
|   |-- alad_charge.txt
|   |-- alad_coordinate.txt
|   |-- alad_dihedral.txt
|   |-- alad_exclude.txt
|   |-- alad_mass.txt
|   |-- alad_nb14.txt
|   |-- alad_residue.txt
|   `-- alad_resname.txt
|-- pysages_metad.py
`-- workspace
    |-- 
    |-- 
    |-- 
    |-- 
    |-- 
    |-- nvt_restart_coordinate.txt
    `-- nvt_restart_velocity.txt

inpysages_metad.pyThis is the PySAGES enhanced sampling method we defined. The content of the file is as follows:

from SpongeExt import enhanced_sponge

import pysages
from  import DihedralAngle
from  import Metadynamics

def phi_psi():
    from numpy import pi
    cvs = [DihedralAngle([4, 6, 8, 14]), DihedralAngle([6, 8, 14, 16])]
    height = 5.0  # kJ/mol
    sigma = [0.4, 0.4]  # radians
    stride = 3
    ngauss = 500
    grid = (lower=(-pi, -pi), upper=(pi, pi), shape=(50, 50), periodic=True)
    method = Metadynamics(cvs, height, sigma, stride, ngauss, grid=grid)
    return method

pysages_method = phi_psi()
Calculate_Force, Mdout_Print = enhanced_sponge(pysages_method)

What can be seen is that we only called a generated function in SpongeExt, and did not directly call any parameters of the underlying CudaSPONGE under the script. On the PySAGES side, it only defines a MetaDynamics method, and does not define any other underlying SnapShot parameters of PySAGES. Using the SpongeExt plug-in can achieve an almost senseless connection. existprotein/Stored under the path are the input parameter files we need to run CudaSPONGE generated by Xponge. existworkspace/Under the path is the CudaSPONGE parameter configuration file of a common NVT we run, of which there is only oneThe file is the parameter input file we need to configure, and the other files are output files generated by running CudaSPONGE.The file content is:

case1 MD simulation

mode = NVT
default_in_file_prefix = ../protein/alad

pbc=0 
cutoff=999

dt = 1e-3
step_limit = 2000
write_information_interval = 10

thermostat = middle_langevin
middle_langevin_gamma = 10

rst = nvt_restart

coordinate_in_file = ../protein/alad_coordinate.txt
plugin = /usr/local/python-3.7.5/lib/python3.7/site-packages/prips/_prips.so
py = ../pysages_metad.py

Compared with the ordinary NVT process, here is just more configurationpluginandpyThese two parameters mean that the relevant interface functions in the python file are called through the prips plug-in, so as to achieve the effect of an external software to implement the enhanced sampling method.

summary summary

Based on the CudaSPONGE high-performance molecular dynamics simulation sampling tool and the PySAGES high-performance enhanced sampling software, I simply packaged a SpongeExt plug-in, which can be used to combine CudaSPONGE and PySAGES for enhanced sampling molecular dynamics simulations without any sense.

Copyright statement

The original link for this article is:/dechinphy/p/

Author ID: DechinPhy

More original articles:/dechinphy/

Ask the blogger for coffee:/dechinphy/gallery/image/

Reference link

  1. /dechin/sponge-ext/tree/master