Skip to content
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "numpy>=2.4.1",
# ]
# ///
import itertools

import numpy as np

M = 1000
N = M * 3
number_density = 0.2 # This is per particle, not per molecule
# rho = N/V
V = N / number_density
L = V ** (1 / 3)

sigmas = [0.9, 1, 1.1]


def main(output_file_name: str) -> None:
"""Create a regular lattice of molecules. These planar molecules are in the x-y plane."""

number_in_each_direction = round(M ** (1 / 3))
dxdydz = L / number_in_each_direction
assert number_in_each_direction**3 == M, "M is not an int to power 3"

r_ab = (sigmas[0] + sigmas[1]) / 2
r_ac = (sigmas[0] + sigmas[2]) / 2
cos_alpha = np.cos(60 / 180)
sin_alpha = np.sin(60 / 180)

f = open(output_file_name, "w")

f.write(f"{N}\n")
f.write(f"columns:molecule,species,position cell:{L},{L},{L}\n")

counter = 1
for i, j, k in itertools.product(
range(number_in_each_direction),
range(number_in_each_direction),
range(number_in_each_direction),
):
r_a = (i * dxdydz, j * dxdydz, k * dxdydz)
r_b = (i * dxdydz, j * dxdydz + r_ab, k * dxdydz)
r_c = (i * dxdydz + r_ac * cos_alpha, j * dxdydz + r_ac * sin_alpha, k * dxdydz)

f.write(f"{counter} 1 {r_a[0]} {r_a[1]} {r_a[2]}\n")
f.write(f"{counter} 2 {r_b[0]} {r_b[1]} {r_b[2]}\n")
f.write(f"{counter} 3 {r_c[0]} {r_c[1]} {r_c[2]}\n")

counter += 1

number_of_bonds = M * 3
f.write(f"{number_of_bonds}\n")
f.write("columns:bond\n")
for i in range(M):
index_of_a = 1 + i * 3
# AB
f.write(f"{index_of_a} {index_of_a + 1}\n")
# BC
f.write(f"{index_of_a + 1} {index_of_a + 2}\n")
# AC
f.write(f"{index_of_a} {index_of_a + 2}\n")


if __name__ == "__main__":
output_file_name = "inputframe.xyz"
main(output_file_name)
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
[system]
config = "./inputframe.xyz"
temperature = 2.0
density = DENSITY
list_type = "LinkedList"

[model]

[model."1-1"]
name = "GeneralKG"
epsilon = 1.0
sigma = 0.9
k = 37.03703703703703
r0 = 1.35

[model."1-2"]
name = "GeneralKG"
epsilon = 1.0
sigma = 0.95
k = 33.24099722991689
r0 = 1.425

[model."1-3"]
name = "GeneralKG"
epsilon = 1.0
sigma = 1.0
k = 30.0
r0 = 1.5

[model."2-2"]
name = "GeneralKG"
epsilon = 1.0
sigma = 1.0
k = 30.0
r0 = 1.5

[model."2-3"]
name = "GeneralKG"
epsilon = 1.0
sigma = 1.05
k = 27.2108843537415
r0 = 1.575

[model."3-3"]
name = "GeneralKG"
epsilon = 1.0
sigma = 1.1
k = 24.79338842975207
r0 = 1.65



[simulation]
type = "Metropolis"
steps = 10000
seed = 10
parallel = false

[[simulation.move]]
action = "Displacement"
probability = 0.8
policy = "SimpleGaussian"
parameters = {sigma = 0.05}

[[simulation.move]]
action = "MoleculeFlip"
probability = 0.2
policy = "DoubleUniform"

[[simulation.output]]
algorithm = "StoreCallbacks"
callbacks = ["energy", "acceptance"]
scheduler_params = {linear_interval = 1}

[[simulation.output]]
algorithm = "StoreLastFrames"
scheduler_params = {linear_interval = 10000}
fmt = "XYZ"

[[simulation.output]]
algorithm = "PrintTimeSteps"
scheduler_params = {linear_interval = 1}
16 changes: 16 additions & 0 deletions examples/ortho-terphenyl/1-create-config-right-density/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

uv run --script create-initial-config.py

density=0.2

while (( $(echo "$density < 1.2" | bc -l ) ))
do
echo "Density" $density

sed "s/DENSITY/$density/" params-template.toml > params.toml
particlesmc params.toml
cp trajectories/1/lastframe.xyz inputframe.xyz

density=$(echo "$density" | awk '{printf "%f", $1 * 1.1}')
done
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

for temperature in 3.0 2.0 1.6 1.4 1.25 1.2 1.15 1.1 1.05 1.0
do
mkdir -p $temperature
sed "s/TEMPERATURE/$temperature/" params-template.toml > $temperature/params.toml
done
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
[system]
config = "../../1-create-config-right-density/inputframe.xyz"
temperature = TEMPERATURE
density = 1.2
list_type = "LinkedList"

[model]

[model."1-1"]
name = "GeneralKG"
epsilon = 1.0
sigma = 0.9
k = 37.03703703703703
r0 = 1.35

[model."1-2"]
name = "GeneralKG"
epsilon = 1.0
sigma = 0.95
k = 33.24099722991689
r0 = 1.425

[model."1-3"]
name = "GeneralKG"
epsilon = 1.0
sigma = 1.0
k = 30.0
r0 = 1.5

[model."2-2"]
name = "GeneralKG"
epsilon = 1.0
sigma = 1.0
k = 30.0
r0 = 1.5

[model."2-3"]
name = "GeneralKG"
epsilon = 1.0
sigma = 1.05
k = 27.2108843537415
r0 = 1.575

[model."3-3"]
name = "GeneralKG"
epsilon = 1.0
sigma = 1.1
k = 24.79338842975207
r0 = 1.65



[simulation]
type = "Metropolis"
steps = 5000000
seed = 10
parallel = false

[[simulation.move]]
action = "Displacement"
probability = 0.8
policy = "SimpleGaussian"
parameters = {sigma = 0.05}

[[simulation.move]]
action = "MoleculeFlip"
probability = 0.2
policy = "DoubleUniform"

[[simulation.output]]
algorithm = "StoreCallbacks"
callbacks = ["energy", "acceptance"]
scheduler_params = {linear_interval = 1000}

[[simulation.output]]
algorithm = "StoreLastFrames"
scheduler_params = {linear_interval = 10000}
fmt = "XYZ"

[[simulation.output]]
algorithm = "StoreTrajectories"
scheduler_params = {linear_interval = 1000}
fmt = "XYZ"

[[simulation.output]]
algorithm = "PrintTimeSteps"
scheduler_params = {linear_interval = 1000}
7 changes: 7 additions & 0 deletions examples/ortho-terphenyl/3-run-production/create-folders.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

for temperature in 3.0 2.0 1.6 1.4 1.25 1.2 1.15 1.1 1.05 1.0
do
mkdir -p $temperature
sed "s/TEMPERATURE/$temperature/" params-template.toml > $temperature/params.toml
done
87 changes: 87 additions & 0 deletions examples/ortho-terphenyl/3-run-production/params-template.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
[system]
config = "../../2-equilibrate-at-different-temperatures/TEMPERATURE/trajectories/1/lastframe.xyz"
temperature = TEMPERATURE
density = 1.2
list_type = "LinkedList"

[model]

[model."1-1"]
name = "GeneralKG"
epsilon = 1.0
sigma = 0.9
k = 37.03703703703703
r0 = 1.35

[model."1-2"]
name = "GeneralKG"
epsilon = 1.0
sigma = 0.95
k = 33.24099722991689
r0 = 1.425

[model."1-3"]
name = "GeneralKG"
epsilon = 1.0
sigma = 1.0
k = 30.0
r0 = 1.5

[model."2-2"]
name = "GeneralKG"
epsilon = 1.0
sigma = 1.0
k = 30.0
r0 = 1.5

[model."2-3"]
name = "GeneralKG"
epsilon = 1.0
sigma = 1.05
k = 27.2108843537415
r0 = 1.575

[model."3-3"]
name = "GeneralKG"
epsilon = 1.0
sigma = 1.1
k = 24.79338842975207
r0 = 1.65



[simulation]
type = "Metropolis"
steps = 5000000
seed = 10
parallel = false

[[simulation.move]]
action = "Displacement"
probability = 0.8
policy = "SimpleGaussian"
parameters = {sigma = 0.05}

[[simulation.move]]
action = "MoleculeFlip"
probability = 0.2
policy = "DoubleUniform"

[[simulation.output]]
algorithm = "StoreCallbacks"
callbacks = ["energy", "acceptance"]
scheduler_params = {linear_interval = 1000}

[[simulation.output]]
algorithm = "StoreLastFrames"
scheduler_params = {linear_interval = 10000}
fmt = "XYZ"

[[simulation.output]]
algorithm = "StoreTrajectories"
scheduler_params = {linear_interval = 4096, log_base=2.0}
fmt = "XYZ"

[[simulation.output]]
algorithm = "PrintTimeSteps"
scheduler_params = {linear_interval = 1000}
Loading