Skip to content

Commit

Permalink
Add partial charges method (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasturcani authored Oct 3, 2024
1 parent 11f9c60 commit 534a2c8
Show file tree
Hide file tree
Showing 15 changed files with 338,945 additions and 338,911 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
- name: Build environment
run: |
conda activate pytest
conda install -c conda-forge openff-toolkit openmm openmmtools
conda install -c conda-forge openff-toolkit openmm openmmtools dgl
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install -e '.[dev]'
Expand All @@ -78,7 +78,7 @@ jobs:
- name: Build environment
run: |
conda activate pytest
conda install -c conda-forge openff-toolkit openmm openmmtools
conda install -c conda-forge openff-toolkit openmm openmmtools dgl
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install -e '.[dev]'
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ docs/build
tests/failures.txt

/examples/gulp_test_output/
/examples/gulp_test_output_MD/
/examples/gulp_test_output_MD/
/examples/.model.pt
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ Some optional dependencies are only available through conda:
mamba install openbabel
# for mdanalysis
mamba install mdanalysis
# for espaloma charge
mamba install dgl
Examples
========
Expand Down
2 changes: 2 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ Some optional dependencies are only available through conda:
mamba install openbabel
# for mdanalysis
mamba install mdanalysis
# for espaloma charge
mamba install dgl
Dependencies
Expand Down
23 changes: 15 additions & 8 deletions examples/openmm_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def main() -> None:
# Load the openff-2.1.0 force field appropriate for
# vacuum calculations (without constraints)
force_field=ForceField("openff_unconstrained-2.1.0.offxml"),
partial_charges_method="mmff94",
partial_charges_method="espaloma-am1bcc",
max_iterations=10,
)
ff_cage = ff_optimizer.optimize(cage)
Expand All @@ -32,7 +32,7 @@ def main() -> None:
"ff_opt_cage",
stko.OpenMMEnergy(
force_field=ForceField("openff_unconstrained-2.1.0.offxml"),
partial_charges_method="mmff94",
partial_charges_method="espaloma-am1bcc",
).get_energy(ff_cage),
)

Expand All @@ -41,15 +41,15 @@ def main() -> None:
# vacuum calculations (without constraints)
force_field=ForceField("openff_unconstrained-2.1.0.offxml"),
restricted=False,
partial_charges_method="mmff94",
partial_charges_method="espaloma-am1bcc",
)
ff_cage = ff_optimizer.optimize(cage)
ff_cage.write(output / "ffunrest_opt_cage.mol")
print(
"ffunrest_opt_cage",
stko.OpenMMEnergy(
force_field=ForceField("openff_unconstrained-2.1.0.offxml"),
partial_charges_method="mmff94",
partial_charges_method="espaloma-am1bcc",
).get_energy(ff_cage),
)

Expand All @@ -58,15 +58,15 @@ def main() -> None:
# vacuum calculations (without constraints)
force_field=ForceField("openff_unconstrained-2.1.0.offxml"),
restricted=True,
partial_charges_method="mmff94",
partial_charges_method="espaloma-am1bcc",
)
ff_cage = ff_optimizer.optimize(cage)
ff_cage.write(output / "ffrest_opt_cage.mol")
print(
"ffrest_opt_cage",
stko.OpenMMEnergy(
force_field=ForceField("openff_unconstrained-2.1.0.offxml"),
partial_charges_method="mmff94",
partial_charges_method="espaloma-am1bcc",
).get_energy(ff_cage),
)

Expand All @@ -80,20 +80,27 @@ def main() -> None:
output_directory=output / "md_optimisation",
integrator=integrator,
random_seed=275,
partial_charges_method="mmff94",
partial_charges_method="espaloma-am1bcc",
reporting_freq=5,
trajectory_freq=5,
num_steps=10000,
num_conformers=50,
platform="CUDA",
conformer_optimiser=stko.OpenMMForceField(
# Load the openff-2.1.0 force field appropriate for
# vacuum calculations (without constraints)
force_field=ForceField("openff_unconstrained-2.1.0.offxml"),
restricted=False,
partial_charges_method="espaloma-am1bcc",
),
)
md_cage = md_optimizer.optimize(cage)
md_cage.write(output / "md_opt_cage.mol")
print(
"md_opt_cage",
stko.OpenMMEnergy(
force_field=ForceField("openff_unconstrained-2.1.0.offxml"),
partial_charges_method="mmff94",
partial_charges_method="espaloma-am1bcc",
).get_energy(md_cage),
)

Expand Down
Loading

0 comments on commit 534a2c8

Please sign in to comment.