Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 4 DOI reference(s) in README
  • Academic publication links
    Links to: acs.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.7%) to scientific vocabulary
Last synced: 10 months ago · JSON representation ·

Repository

Basic Info
  • Host: GitHub
  • Owner: ChiahsinChu
  • License: lgpl-3.0
  • Language: Python
  • Default Branch: main
  • Size: 713 KB
Statistics
  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • Open Issues: 0
  • Releases: 1
Created over 1 year ago · Last pushed about 1 year ago
Metadata Files
Readme License Citation

README.md

DMFF in PyTorch backend

codecov

torch version of ADMP is initialized by Zheng Cheng (AISI).

This package implements the PME method (for monopoles) and the QEq method in DMFF with PyTorch, allowing not only GPU-accelerated calculation of PME/QEq methods but also further customization and extension of other PyTorch-based models.

Installation

This package can be installed by:

bash git clone https://github.com/ChiahsinChu/torch-admp pip install torch-admp

For the unit tests, you can install the package with the following command:

bash git clone https://github.com/ChiahsinChu/torch-admp pip install torch-admp[test]

To-do

  • [ ] Add doc for usage
  • [ ] Add unittest for QEq v.s. RuNNer

Examples

QEq

openmm-torch

```python from torchadmp.qeq import QEqAllForceModule from torchadmp.pme import setupewaldparameters

kappa, kx, ky, kz = setupewaldparameters(rcut, box) module = QEqAllForceModule(q0, chi, hardness, eta, rcut, kappa, (kx, ky, kz)) jitmodule = torch.jit.script(module) out = jitmodule(positions, box) ```

| Notation | Description | Unit | | ---------- | ------------------------------------------- | -------------- | | $qi$ | charge of atom $i$ | charge | | $zi$ | z-coordinate of atom $i$ | length | | $Lz$ | length of the simulation box in z-direction | length | | V | volume of supercell | length $^3$ | | $\alpha$ | Ewald screening parameter | length $^{-1}$ | | $\sigmai$ | Gaussian width of atom $i$ | length |

Coulomb interaction [ref]

For non-periodic systems, the Coulomb interaction can be calculated directly:

$$ \begin{align} E{elec}=\sumi \sum{j\neq i} \frac{qi qj}{r{ij}}. \end{align} $$

For periodic systems, we consider the Ewald summation under 3D-PBC:

$$ \begin{aligned} E{elec}=E{real}+E{recip}+E{self}+E_{corr}. \end{aligned} $$

The real space interaction:

$$ \begin{align} E{real}=\frac{1}{2}\sum{i,j}qiqj \frac{\text{erfc}(\alpha r{ij})}{r{ij}}. \end{align} $$

The reciprocal interaction:

$$ \begin{align} E{recip}=\frac{2\pi}{V}\sum{k^\prime}\frac{S(k)^2}{k^2}\exp{\left(-\frac{k^2}{4\alpha^2}\right)}, \end{align} $$

where the structural factor $S(k)$ is given by:

$$ \begin{align} S(k)=\sumi qi\exp(ik\cdot r_i). \end{align} $$

The self interaction:

$$ \begin{align} E{self}=-\frac{\alpha}{\sqrt{\pi}}\sumi q_i^2. \end{align} $$

Non-neutral correction (only with which the energy from 3D Ewald summation is independent with $\alpha$):

$$ \begin{aligned} E=-\frac{\pi}{2V\alpha^2}Q_{tot}^2. \end{aligned} $$

Gaussian damping [ref]

  • DampingForceModule

While the standard Ewald summation is used to calculate the electrostatic interactions between point charges, an additional Gaussian damping term can be applied to adapt the Ewald summation for the Gaussian charges. The damping term is, in fact, a modification of interactions in the real space:

$$ \begin{align} E=-\frac{1}{2}\sum{i,j}qiqj \frac{\text{erfc}(\frac{r{ij}}{2\sigma{ij}})}{r{ij}}+\frac{1}{2\sigmai\sqrt{\pi}}\sumi q_i^2, \end{align} $$

where

$$ \sigma{ij} = \sqrt{\frac{\sigmai^2 + \sigma_j^2}{2}}. $$

Slab correction [ref]

  • SlabCorrForceModule

When aiming for 2D periodic boundary conditions, the slab correction can be appiled [ref]:

This is done by treating the system as if it were periodic in z, but inserting empty volume between atom slabs and removing dipole inter-slab interactions so that slab-slab interactions are effectively turned off.

The energy for slab correction is given by:

$$ \begin{align} E &= \frac{2\pi}{V} \left( Mz^2 - Q{\text{tot}} \sumi qi zi^2 + Q{\text{tot}}^2\frac{L_z^2}{12} \right), \end{align} $$

where

$$ \begin{align} Mz &= \sumi qi zi, \ Q{\text{tot}} & = \sumi q_i . \end{align} $$

Unlike lammps, where the empty volume can be inserted internally by the program, the users of this package are expected to insert vacuum with sufficient thickness when building the models to avoid interactions between slabs. Empirically, the thickness of the vacuum is suggested to be twice of the slab thickness.

Chemical interaction [ref]

  • SiteForceModule

In the QEq model, not only the electrostatic interaction but the chemical interaction are considered:

$$ \begin{align} E=\sumi \chii qi+\frac{1}{2}\sumi Jiqi^2. \end{align} $$

Owner

  • Name: Jia-Xin Zhu
  • Login: ChiahsinChu
  • Kind: user
  • Location: Xiamen, China
  • Company: Xiamen University

Ph.D. candidate in Xiamen University. Interests: Theoretical and computational electrochemistry.

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Zhu"
  given-names: "Jia-Xin"
  orcid: "https://orcid.org/0000-0002-3471-4728"
- family-names: "Cheng"
  given-names: "Zheng"
- family-names: "Yu"
  given-names: "Kuang"
title: "DMFF in PyTorch backend"
version: 1.0.0a
date-released: 2025-02-01
url: "https://github.com/ChiahsinChu/torch-admp"

GitHub Events

Total
  • Create event: 2
  • Release event: 1
  • Issues event: 4
  • Delete event: 2
  • Issue comment event: 1
  • Member event: 1
  • Push event: 30
  • Pull request review event: 2
  • Pull request review comment event: 2
  • Pull request event: 2
Last Year
  • Create event: 2
  • Release event: 1
  • Issues event: 4
  • Delete event: 2
  • Issue comment event: 1
  • Member event: 1
  • Push event: 30
  • Pull request review event: 2
  • Pull request review comment event: 2
  • Pull request event: 2

Dependencies

pyproject.toml pypi
  • numpy >=1.20.0
  • scipy >=1.6.0
  • torch >=2.1.0
  • torchopt ==0.7.3