| Crates.io | ffcharge |
| lib.rs | ffcharge |
| version | 0.2.0 |
| created_at | 2026-01-05 10:34:18.405705+00 |
| updated_at | 2026-01-05 11:17:07.012318+00 |
| description | A lightweight pure Rust library for fast, residue-based force field charge assignment (AMBER/CHARMM) in molecular modeling pipelines. |
| homepage | |
| repository | https://github.com/TKanX/ffcharge |
| max_upload_size | |
| id | 2023593 |
| size | 363,119 |
FFCharge is a lightweight, pure Rust library for fast, residue-based force field partial charge assignment in molecular modeling pipelines. It provides pre-computed atomic partial charges from AMBER and CHARMM force fields for proteins, nucleic acids, water, and ions.
Designed with no_std support and zero runtime dependencies, FFCharge is ideal for high-performance molecular dynamics preprocessing, biomolecular structure analysis, and integration into existing simulation workflows.
no_std Compatible: Suitable for embedded systems and WebAssembly targets.Add FFCharge to your Cargo.toml:
[dependencies]
ffcharge = "0.2.0"
use ffcharge::{ProteinScheme, NucleicScheme, WaterScheme, IonScheme, Position};
fn main() {
// Protein: Get charge for CA atom of Alanine (middle position, AMBER ff99SB)
let charge = ProteinScheme::AmberFFSB
.charge(Position::Middle, "ALA", "CA")
.expect("Charge not found");
println!("ALA CA charge: {:.4}", charge);
// Protein: N-terminal residue
let n_term_charge = ProteinScheme::AmberFFSB
.charge(Position::NTerminal, "ALA", "N")
.expect("Charge not found");
println!("N-terminal ALA N charge: {:.4}", n_term_charge);
// Nucleic acid: DNA adenine at 5' terminus (AMBER)
let dna_charge = NucleicScheme::Amber
.charge(Position::FivePrime, "DA", "N9")
.expect("Charge not found");
println!("DA N9 charge: {:.4}", dna_charge);
// Water: TIP3P model
let water = WaterScheme::Tip3p.charges().expect("Water model not found");
println!("TIP3P: O={:.4}, H1={:.4}, H2={:.4}", water.o, water.h1, water.h2);
// Ion: Sodium
let na_charge = IonScheme::Classic
.charge("NA")
.expect("Ion not found");
println!("Na+ charge: {:.1}", na_charge);
}
For detailed API documentation, visit the API Documentation.
For complete residue and atom listings, see data/README.md.
Summary:
This project is licensed under the MIT License - see the LICENSE file for details.