Skip to content

ConformMin-cMCTS: Repository for conformational energy global minimization using continuous Monte Carlo Tree Search (CMCTS) algorithm.

License

Notifications You must be signed in to change notification settings

Hamlet99/ConformMin-cMCTS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Documentation Status

ConformMin-cMCTS

ConformMin-cMCTS: Repository for conformational energy global minimization using continuous Monte Carlo Tree Search (cMCTS) algorithm.

Continuous Monte Carlo Tree Search (cMCTS) algorithm was implemented based on papers listed below:

Installation

To install the package, you can use pip after cloning the repository to your local machine.

git clone [email protected]:Hamlet99/ConformMin-cMCTS.git
cd /path/to/ConformMin-cMCTS/
pip install -e .

Usage

Specify your Model

Specify all parameters of the model to be solved in a config_mcts.json configuration file, with the following structure:

{
    "n_iterations": 200,
    "n_expand": 10,
    "n_playouts": 20,
    "explore_constant": 1.0,
    "max_depth": 12,
    "a": 3
}
  • "n_iterations" (int) The number of iterations for the MCTS algorithm. Default is 200.
  • "n_expand" (int) The number of expansions to perform during each iteration. Default is 10.
  • "n_playouts" (int) The number of playouts to perform. Default is 20.
  • "explore_constant" (float) The exploration constant for the Upper Confidence Bound (UCB) formula. Default is 1.0.
  • "max_depth" (int) The maximum depth of the search tree. Default is 12.
  • "a" (float) A scaling parameter used for perturbation. Default is 3.0.

Run the MCTS algorithm

To run the MCTS algorithm, you can use the following code in your Python script or Jupyter notebook (example.ipynb):

from cMCTS import environment
from cMCTS import mcts
from cMCTS import perturbation

smiles = 'c1cnccc1c1ccncc1NC'

#Initialize the environment and draw the marked molecule using RDKit
env = environment.Environment(smiles)
root_data = env.create_root_parameters()
env.draw()

#Initialize the perturbator
max_mutation = 10 #maximum mutation allowed
perturbator = perturbation.Perturbation(max_mutation)

# read the config file
with open('config_mcts.json') as f:
    config = json.load(f)
    print(config)

# set perturb and evaluate functions 
perturb = perturbator.perturb
evaluate = env.evaluate

# initialize, run cMCTS, and generate "mcts_results.json" file
optimizer = mcts.cMCTS(root_data, perturb, evaluate, **config)
optimizer.run()
optimizer.write()

# to visualize the optimization process use the following command  
optimizer.plot_minimization(lim_iterations=[0,1000])

License ConformMin-cMCTS is released under the MIT License. See LICENSE for details.

About

ConformMin-cMCTS: Repository for conformational energy global minimization using continuous Monte Carlo Tree Search (CMCTS) algorithm.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published