cmelab / cmelab/Advanced-Sampling

Automating post equilibrium operations

Open
#40 4 comments 0 reactions 4 assignees Claimed by @chrisjonesBSU View on GitHub
Dominant language
Python
Stars
1
Forks
2
PR merge metrics
No merged PRs in 30d

Description

This issue is devoted to discussions and ideas around post-run operations.
Here is a detailed description of what needs to be done.

Let's discuss the details in this thread and put our suggestions. I will mark some discussion points that I think are worth discussing here.

Once a Signac's job run is finished, we need to perform a few steps automatically:
### Step 1: Check Equilibrium

Check whether equilibrium is achieved at the end of the simulation. If not, restart the simulation from the last state point and resume. This cycle will be repeated until the equilibrium is reached.
- For checking equilibrium condition, probably need to use `is_equilibrated` method in [cmeutils's repo.](https://github.com/cmelab/cmeutils/blob/348648020a9d22450828a7ca5a599c2dc1c34111/cmeutils/sampling.py#L47). (we need to check this function first to make sure it is the right function for our usecase)
- If not equilibrated, the simulation object must be recreated with `restart=True`. This will resume the system from last snapshot. Call `sim.run(...)` to resume the run.

**Implementation details:**

- Equilibrium check step can be done somewhere in signac's `sample()` method in `project.py`. We can discuss the implementation details **(discussion number 1)**. My suggestion is either using a while loop conditioned on the equilibrium state or a for loop with a cap on the number of run attempts.
- To track the equilibration process, we can define `equilibrium_state` in job.doc. Setting it `False` by default during job initiation (inside the init.py file) , and setting it to `True` when equilibrated.
- Log number of run attempts in job.doc.
- Making sure saved simulation files are updating according to equilibration process. For example, for each attempt, we can create a new `trajectory.gsd` file or append to the previous once. (discussion num. 2)
- Making sure logged values in job.doc are updating accordingly. Do we want values such as ` job.doc["tps"]`, `job.doc["accepted_moves"]`, `job.doc["acceptance_ratio"]` to represent the whole process or only the last run attempt? (discussion num. 3)

### Step 2: Post Equilibrium
After equilibration, save information such as decorrelation step and starting index in job.doc.

**Implementation details:**

- `equil_sample()` method in [cmeutils](https://github.com/cmelab/cmeutils/blob/348648020a9d22450828a7ca5a599c2dc1c34111/cmeutils/sampling.py#L4) seems to be a good option. It uses pymbar timeseries module to find the start index for sampling. It returns the independent samples as well.
- We can use Signac's pre/post operations to perform this step automatically. An operation in signac is triggered once its pre-conditions are met or at least one of its post-conditions is not met. This is a great opportunity to learn more about Signac. Here is some clues to start: [signac tutorial](https://docs.signac.io/en/latest/tutorial.html#operating-on-the-data-space), [simple signac project with pre and post conditions](https://github.com/glotzerlab/signac-workshop/blob/main/1-intro/project.py).

### Step 3: Save structural/analytical data
logging information that will be used later to draw phase diagrams or to analyze the trajectory :

- Potential energy mean and standard deviation (Save in job.doc)
- RDF, RDF peaks, ... (save in a txt file)
- Average nearest neighbors (save in job.doc). We can take a step further and use the first minimum in RDF as the `r_max`.
- [Add more if I missed something here]

**Implementation details:**
Same as previous step, this step can be automated using Signac's post/pre conditions.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.