Skip to content

Commit 18cf2dc

Browse files
committed
Add Usage section
1 parent 528bd03 commit 18cf2dc

1 file changed

Lines changed: 46 additions & 4 deletions

File tree

README.md

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,54 @@ This will build the `particlesmc` executable at `~/.julia/bin` (please add this
6464

6565
### Running a Monte Carlo Simulation
6666

67-
To run a Monte Carlo simulation, you need to define the systems and moves, and then use the provided functions to execute the simulation. Here is a basic example:
68-
69-
Add example code
70-
```julia
67+
To run a Monte Carlo simulation, you need an input atomic or molecular configuration file (typically with a `.xyz` extension) and a parameter file (in `TOML` format). The parameter file specifies both the system details (such as temperature, density, and interaction model) and the simulation details (such as simulation type, number of steps, Monte Carlo moves, and outputs). A minimal example is presented below. More detailed explanations can be found in the documentation.
68+
69+
**params.toml**
70+
```toml
71+
[system]
72+
config = "config.xyz"
73+
temperature = 1.0
74+
density = 1.19206
75+
list_type = "LinkedList"
76+
77+
[model]
78+
[model."1-1"]
79+
name = "LennardJones"
80+
epsilon = 1.0
81+
sigma = 1.0
82+
rcut = 2.5
83+
84+
[simulation]
85+
type = "Metropolis"
86+
steps = 500
87+
seed = 10
88+
parallel = false
89+
output_path = "./"
90+
91+
[[simulation.move]]
92+
action = "Displacement"
93+
probability = 1.0
94+
policy = "SimpleGaussian"
95+
parameters = {sigma = 0.05}
96+
97+
[[simulation.output]]
98+
algorithm = "StoreTrajectories"
99+
scheduler_params = {linear_interval = 50}
100+
fmt = "XYZ"
71101
```
72102

103+
**Explanation of the example:**
104+
105+
This example defines a minimal Monte Carlo simulation setup:
106+
107+
- The `[system]` section specifies the input configuration file (`config.xyz`), the simulation temperature and density, and the use of a linked list for neighbor searching.
108+
- The `[model]` section defines the interaction potential between particles. Here, a Lennard-Jones potential is used for species pair "1-1" with specified parameters (`epsilon`, `sigma`, and cutoff `rcut`).
109+
- The `[simulation]` section sets the simulation type to Metropolis, the number of Monte Carlo steps to 500, the random seed, whether to run in parallel, and the output path.
110+
- The `[[simulation.move]]` section describes the Monte Carlo move to use: a displacement move with probability 1.0, guided by a simple Gaussian policy with a standard deviation (`sigma`) of 0.05.
111+
- The `[[simulation.output]]` section configures the output: trajectories will be stored every 50 steps in the XYZ format.
112+
113+
By executing `particlesmc params.toml` you will run a basic Metropolis Monte Carlo simulation of particles interacting via the Lennard-Jones potential, using displacement moves, and periodically saving the system's trajectory.
114+
73115
## Contributing
74116

75117
We welcome contributions from the community. If you have a new system or feature to add, please fork the repository, make your changes, and submit a pull request.

0 commit comments

Comments
 (0)