Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update changelog with current commits #95

Merged
merged 1 commit into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ The rules for this file:
* accompany each entry with github issue/PR number (Issue #xyz)
-->

## v0.3.5 -- 2024-03-21

### Authors
<!-- GitHub usernames of contributors to this release -->
- @Yoshanuikabundi
- @lilyminium

### Fixed
- Fixes to docs and examples (Issue #92, PR #73)


## v0.3.4 -- 2024-02-15

### Authors
Expand Down
314 changes: 314 additions & 0 deletions examples/x-distances.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,314 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "8a760402-7d7f-4fc9-a54b-e033bf035101",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "aa6b8a7de47141f3900a071a6f580a85",
"version_major": 2,
"version_minor": 0
},
"text/plain": []
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import mdtraj\n",
"import nglview\n",
"import openmm\n",
"import openmm.unit\n",
"from openff.toolkit import Molecule, ForceField\n",
"from openff.units import unit\n",
"\n",
"def viz(\n",
" smiles: str,\n",
" force_field: ForceField,\n",
") -> nglview.NGLWidget:\n",
" molecule = Molecule.from_smiles(smiles, allow_undefined_stereo=True)\n",
" molecule.generate_conformers(n_conformers=1)\n",
"\n",
" interchange = force_field.create_interchange(molecule.to_topology())\n",
" print(len(interchange.collections[\"VirtualSites\"].key_map))\n",
"\n",
" return interchange._visualize_nglview(include_virtual_sites=True)\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "f920795f-0d48-4b2b-a83b-dedbfe011e01",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/lily/micromamba/envs/openff-toolkit-test/lib/python3.11/site-packages/MDAnalysis/topology/guessers.py:146: UserWarning: Failed to guess the mass for the following atom types: X\n",
" warnings.warn(\"Failed to guess the mass for the following atom types: {}\".format(atom_type))\n"
]
}
],
"source": [
"import MDAnalysis as mda\n",
"\n",
"u = mda.Universe(\"xyz_with_extra_point_charges.xyz\")"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "9d60218e-d206-47ac-8935-181786528221",
"metadata": {},
"outputs": [],
"source": [
"ff = ForceField(\"openff-2.1.0.offxml\")\n",
"handler = ff.get_parameter_handler(\"VirtualSites\")\n",
"handler.add_parameter({\n",
" \"type\": \"BondCharge\",\n",
" \"smirks\": \"[#6A:2]-[#35:1]\",\n",
" \"name\": \"EP1\",\n",
" \"distance\": 0.41 * unit.angstrom,\n",
" \"charge_increment\": [\n",
" -0.082 * unit.elementary_charge,\n",
" 0.0 * unit.elementary_charge\n",
" ],\n",
" \"sigma\": 0.0 * unit.angstrom,\n",
" \"epsilon\": 0.0 * unit.kilojoules_per_mole,\n",
" \"match\": \"all_permutations\"\n",
" })\n",
"handler.add_parameter({\n",
" \"type\": \"BondCharge\",\n",
" \"smirks\": \"[#6A:1]-[#35:2]\",\n",
" \"name\": \"EP2\",\n",
" \"distance\": -1.53 * unit.angstrom,\n",
" \"charge_increment\": [\n",
" -0.082 * unit.elementary_charge,\n",
" 0.0 * unit.elementary_charge\n",
" ],\n",
" \"sigma\": 0.0 * unit.angstrom,\n",
" \"epsilon\": 0.0 * unit.kilojoules_per_mole,\n",
" \"match\": \"all_permutations\"\n",
" })"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "608e8c74-b467-477f-bc84-f863a5f51bd5",
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "b8c92330467549acbeaf42f4058fea47",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"NGLWidget()"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"viz(\"CBr\", ff)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "af278af1-7493-40e9-8680-55ca50e83111",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array(['Br', 'X', 'X', 'C', 'H', 'H', 'H'], dtype=object)"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"u.atoms.names"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "3236b28d-cb6c-4ae5-b86c-0b0bef076461",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.5275864220791338"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"u.atoms[[3, 1]].bond.value()"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "06b1f884-3d60-4408-8322-632307fd18ed",
"metadata": {},
"outputs": [
{
"ename": "SyntaxError",
"evalue": "invalid syntax (567753897.py, line 1)",
"output_type": "error",
"traceback": [
"\u001b[0;36m Cell \u001b[0;32mIn[7], line 1\u001b[0;36m\u001b[0m\n\u001b[0;31m u.atoms[[, 2]].bond.value()\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n"
]
}
],
"source": [
"u.atoms[[, 2]].bond.value()"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "d07d5fb6",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "76e7ee5c169a45a2a5a011041aa56f35",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"NGLWidget()"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"nglview.show_mdanalysis(u)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "ab368fa9-a265-4fb1-84bb-8fdb60e526e9",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "79764fbc727a4c648f40f7d5cd8d9ff2",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"NGLWidget()"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"nglview.show_mdanalysis(u.atoms[[0, 1, 3, 4, 5, 6]])"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "f750c5fe",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "8640046456824fa1a78bcda4e5e81319",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"NGLWidget()"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"nglview.show_mdanalysis(u.atoms[[0, 2, 3, 4, 5, 6]])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6d8dee0e",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python (openff-toolkit-test)",
"language": "python",
"name": "openff-toolkit-test"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading