Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
decebaa
Add CLI for running TurtleMD
andersle Sep 15, 2023
53ab21e
Added methods for creating a box from settings
andersle Sep 15, 2023
1e87340
Adding methods for inspecting functions and added method for creating…
andersle Sep 18, 2023
90662ee
Added the types-toml to the dependencies.
andersle Sep 18, 2023
e43ec65
Updated method for initiating classes from settings.
andersle Sep 19, 2023
54b637d
Added generic factorry method.
andersle Sep 19, 2023
9934c7a
Moved the Register method out of integrators.
andersle Sep 20, 2023
fd0252f
Updated the registry.
andersle Sep 21, 2023
129e8ab
Added test of the generic factory.
andersle Sep 21, 2023
89ccae8
Updated docstrings from the common methods for creating objects.
andersle Sep 22, 2023
a588c98
Adding creating of particles from external file.
andersle Oct 6, 2023
91f3ed9
Merge branch 'main' into add_input_file
andersle Oct 6, 2023
5f166c4
Black update.
andersle Oct 6, 2023
dc694e0
Update pre-commits
andersle Oct 6, 2023
36c4768
Updated test for creating a system from settings.
andersle Oct 6, 2023
8f3b93a
Some spelling updates.
andersle Dec 15, 2023
8db5a92
Updated spelling and docs.
andersle Dec 15, 2023
5529eaa
Moved import order.
andersle Dec 16, 2023
cc1ac64
Mopved some files around.
andersle Dec 16, 2023
a607460
Added method for writing xyz.
andersle Dec 18, 2023
e9ec02d
Added support for 1D or 2D xyz.
andersle Dec 18, 2023
c753e1f
Merge branch 'main' into add_input_file
andersle Jan 2, 2024
0af4fe9
Added support for creating triclinic boxes from settings.
andersle Jan 3, 2024
96e6808
Added test for bin
andersle Jan 4, 2024
427fc88
Added _str__ method for the system.
andersle Jan 4, 2024
164e225
Added testing of creating all integrators from .toml files.
andersle Jan 4, 2024
8d7323e
Updated creating of particles from the settings.
andersle Jan 4, 2024
96daaad
Added generation of velocities.
andersle Jan 15, 2024
be84436
Added units (for converting the input time...)
andersle Jan 17, 2024
f99c0d9
Added test of units
andersle Jan 17, 2024
ecc380f
Removed unused type: ignore.
andersle Jan 17, 2024
bdc6e0d
Added missing docstring.
andersle Jan 17, 2024
1e347e0
Version bump
andersle Feb 14, 2024
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
17 changes: 15 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
repos:
- repo: https://github.com/psf/black
rev: 23.7.0
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
- id: black-jupyter
# It is recommended to specify the latest version of Python
# supported by your project here, or alternatively use
# pre-commit's default_language_version, see
# https://pre-commit.com/#top_level-default_language_version
language_version: python3.11
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.0.292
hooks:
- id: ruff
types_or: [python, pyi, jupyter]
4 changes: 1 addition & 3 deletions examples/lennard.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ def create_system():
for xyz in pos:
particles.add_particle(pos=xyz, mass=1.0, ptype=0, name="Ar")

generate_maxwell_velocities(
particles, rgen=default_rng(), temperature=0.8
)
generate_maxwell_velocities(particles, rgen=default_rng(), temperature=0.8)

lennard = LennardJonesCut(dim=3, shift=True, mixing="geometric")
parameters = {
Expand Down
1 change: 0 additions & 1 deletion examples/movie-doublewell-pair.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from turtlemd.tools import generate_lattice

sns.set_context("talk", font_scale=0.8)
# matplotlib.rcParams.update({'font.size': 10})


def create_system() -> System:
Expand Down
8 changes: 7 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "turtlemd"
version = "2023.3.1"
version = "2024.1"
description = "A slow molecular dynamics library for testing"
authors = [
"Daniel Zhang <daniel.t.zhang@ntnu.no>",
Expand All @@ -13,6 +13,8 @@ readme = "README.md"
[tool.poetry.dependencies]
python = ">=3.10,<3.13"
numpy = "^1.24.2"
toml = "^0.10.2"
pint = "^0.23"

[tool.poetry.group.dev.dependencies]
ruff = "^0.0.261"
Expand All @@ -24,6 +26,7 @@ pytest-randomly = "^3.12.0"
jupyter-black = "^0.3.4"
pre-commit = "^3.3.3"
flake8 = "^6.0.0"
types-toml = "^0.10.8.7"

[tool.ruff]
line-length = 79
Expand All @@ -39,6 +42,9 @@ warn_unused_ignores = true
show_error_codes = true
plugins = "numpy.typing.mypy_plugin"

[tool.poetry.scripts]
turtlemd = "turtlemd.bin:main"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
4 changes: 4 additions & 0 deletions tests/inout/box1.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[box]
low = [10, 11, 12]
high = [23, 24, 25]
periodic = [true, true, true]
4 changes: 4 additions & 0 deletions tests/inout/box2.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[box]
low = [10, 11, 12]
high = [23, 24, 25]
periodic = true
6 changes: 6 additions & 0 deletions tests/inout/box3.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[box]
low = [10, 11, 12]
high = [23, 24, 25]
periodic = [true, true, true]
alpha = 75
beta = 60
4 changes: 4 additions & 0 deletions tests/inout/config/start.xyz
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
2
# Step 2 box: 1.0 2.0 3.0
A 1.0 1.0 1.0 1.0 1.0 1.0
B 2.0 2.0 2.0 1.0 1.0 1.0
7 changes: 7 additions & 0 deletions tests/inout/config/system_one_down.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[box]
periodic = [true, true, true]
low = [0.0, 0.0, 0.0]
high = [1.0, 1.0, 1.0]

[particles]
file = "../start2.xyz"
3 changes: 3 additions & 0 deletions tests/inout/integrators/integrator.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[integrator]
class = "this-is-integrator-hello"
timestep = 1234.5678
6 changes: 6 additions & 0 deletions tests/inout/integrators/langevin1.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[integrator]
class = "LangevinOverdamped"
timestep = 1
gamma = 2
beta = 3
seed = 123
6 changes: 6 additions & 0 deletions tests/inout/integrators/langevin2.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[integrator]
class = "LangevinInertia"
timestep = 1
gamma = 2
beta = 3
seed = 123
3 changes: 3 additions & 0 deletions tests/inout/integrators/velocityverlet.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[integrator]
class = "VelocityVerlet"
timestep = 1234.5678
3 changes: 3 additions & 0 deletions tests/inout/integrators/verlet.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[integrator]
class = "Verlet"
timestep = 1234.5678
40 changes: 40 additions & 0 deletions tests/inout/md.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Molecular Dynamics Configuration

# Basic MD settings
[md]
total_steps = 200 # Total simulation steps
temperature = 298.15 # Kelvin

# Integrator settings
[integrator]
class = "VelocityVerlet"
timestep = 0.005

# Initial structure file:
[particles]
file = "config/start.xyz"

[particles.masses]
Ar = 1.0

[particles.types]
Ar = 1

# Periodic boundary conditions:
[box]
periodic = true
high = [10.0, 10.0, 10.0]

# Potential/Forcefield settings
[potential]
type = "Lennard-Jones" # Could also be "AMBER", "CHARMM", etc.

[potential.parameters]
epsilon = 1.0 # LJ epsilon parameter (for Lennard-Jones potential)
sigma = 3.40 # LJ sigma parameter (for Lennard-Jones potential)
cut = 2.5 # Cut-off for the potential

# Output settings:
[output]
trajectory_file = "traj.xyz"
log_file = "md.log"
16 changes: 16 additions & 0 deletions tests/inout/nesting.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[box]
periodic = [true, true, true]
low = [0.0, 0.0, 0.0]
high = [1.0, 1.0, 1.0]

[system]
file = "system"

[particles]
file = "particles"

[system.particles]
file = "system.particles"

[x.y.z.w]
file = "x.y.z.w"
2 changes: 2 additions & 0 deletions tests/inout/particles/masses.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
123.
456.
15 changes: 15 additions & 0 deletions tests/inout/particles/particles1.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[box]
periodic = [true, true, true]
low = [0.0, 0.0, 0.0]
high = [1.0, 1.0, 1.0]

[particles]
file = "../config/start.xyz"

[particles.masses]
A = 2.0
B = 10.0

[particles.types]
A = 9
B = 55
9 changes: 9 additions & 0 deletions tests/inout/particles/particles2.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[box]
periodic = [true, true, true]
low = [0.0, 0.0, 0.0]
high = [1.0, 1.0, 1.0]

[particles]
file = "../config/start.xyz"
mass_list = [10.0, 40.0]
type_list = [99, 101]
9 changes: 9 additions & 0 deletions tests/inout/particles/particles3.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[box]
periodic = [true, true, true]
low = [0.0, 0.0, 0.0]
high = [1.0, 1.0, 1.0]

[particles]
file = "../config/start.xyz"
mass_file = "masses.txt"
type_file = "types.txt"
2 changes: 2 additions & 0 deletions tests/inout/particles/types.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
33.
77.
12 changes: 12 additions & 0 deletions tests/inout/start.xyz
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
2
# Step 2 box: 1.0 2.0 3.0
A 1.0 1.0 1.0 1.0 1.0 1.0
B 1.0 1.0 1.0 1.0 1.0 1.0
2
# Step 3 box: 1.0 2.0 3.0
A 4.0 4.0 4.0 4.0 4.0 4.0
B 4.0 4.0 4.0 4.0 4.0 4.0
2
# Step 4 box: 1.0 2.0 3.0
A 8.0 8.0 8.0 8.0 8.0 8.0
B 8.0 8.0 8.0 8.0 8.0 8.0
4 changes: 4 additions & 0 deletions tests/inout/start2.xyz
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
2
# Step 4 box: 1.0 2.0 3.0
A 8.0 8.0 8.0 8.0 8.0 8.0
B 8.0 8.0 8.0 8.0 8.0 8.0
7 changes: 7 additions & 0 deletions tests/inout/system.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[box]
periodic = [true, true, true]
low = [0.0, 0.0, 0.0]
high = [1.0, 1.0, 1.0]

[particles]
file = "config/start.xyz"
7 changes: 7 additions & 0 deletions tests/inout/system_missing_xyz.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[box]
periodic = [true, true, true]
low = [0.0, 0.0, 0.0]
high = [1.0, 1.0, 1.0]

[particles]
file = "config/start_not_present.xyz"
10 changes: 10 additions & 0 deletions tests/inout/system_units1.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[system]
units = "real"

[box]
periodic = [true, true, true]
low = [0.0, 0.0, 0.0]
high = [1.0, 1.0, 1.0]

[particles]
file = "config/start.xyz"
10 changes: 10 additions & 0 deletions tests/inout/system_units2.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[system]
units = "units-that-does-not-exist"

[box]
periodic = [true, true, true]
low = [0.0, 0.0, 0.0]
high = [1.0, 1.0, 1.0]

[particles]
file = "config/start.xyz"
Loading