Giter VIP home page Giter VIP logo

steepest-descent's Introduction

Steepest Descent Algorithm for Water Molecules Energy Minimization


Authors:

ZHUKOVA Nadezhda - SERRALTA Théo

Master 1 Bio-informatics at Univerité Paris Cité.


This Python application minimizes the energy of water molecules using the steepest descent algorithm. Two methods of gradient calculation are available: analytical gradient and numerical gradient. There are two scripts available: mini1.py and mini2.py according to the method of gradient calculation and the number of water molecules in the system. Use mini1.py for a single water molecule and mini2.py for any number of water molecules.

Create the environment

To clone the repository, use the following command:

git clone [email protected]:zhukovanadezhda/steepest-descent.git

To setup the conda environment :

Install miniconda and mamba. Create the steepest-descent conda environment:

mamba env create -f binder/environment.yml
cd steepest-descent
conda activate steepest-descent

Run the application

To test the algorithm of ONE water molecule, you can use the following command:

python3 scripts/mini1.py <pdbfile> [analytical|numerical]

Where <pdbfile> is the path to the PDB file containing the coordinates of the water molecule. The analytical method is used by default if no method is specified. The file should be in the following format:

ATOM      1  OH  OSP3    1       4.013   0.831  -9.083  1.00  0.00              
ATOM      2 1HH  OSP3    1       4.941   0.844  -8.837  1.00  0.00              
ATOM      3 2HH  OSP3    1       3.750  -0.068  -9.293  1.00  0.00
...

You can modify various minimization parameters in the main program of the script. Here's what they correspond to:

  • h: Small value used for numerical gradient calculation.
  • step_size: Step size for updating coordinates during minimization.
  • threshold: Convergence threshold for the Gradient Root Mean Square (GRMS). Optimization stops when GRMS is below this threshold.
  • max_iterations: Maximum number of iterations allowed to avoid infinite loops.
  • k_bond: Force constant for bond energy calculation.
  • i_eq: Equilibrium distance for bond lengths.
  • k_angle: Force constant for angle energy calculation.
  • theta_eq: Equilibrium angle in degrees.

To test the algorithm of ANY number of water molecules, you can use the following command:

python3 scripts/mini2.py <filename> 

Where <filename> is the path to the file containing the coordinates of the water molecules. The file should be in the following format:

1SOL     OW    1   1.713   1.641   1.519
1SOL    HW1    2   1.768   1.719   1.520
1SOL    HW2    3   1.776   1.568   1.514
...

Attention!

Don't forget to update water molecule system constants according to the number of molecules. The default mode constants work for 3 molecules.

Examples of usage

  1. One water molecule energy minimisation with analytical gradient
python3 scripts/mini1.py data/one_water_1.txt analytical
Nombre maximal d'itérations atteint sans convergence.
Iteration 1000 - GRMS: 1.0966692735016927e-09
Énergie finale : 1.2148634994298813e-19 kcal/mol
Angle après minimisation : 104.5200 degrés
Longueur de liaison l1 après minimisation : 0.9572 Å
Longueur de liaison l2 après minimisation : 0.9572 Å
  1. One water molecule energy minimisation with numerical gradient
python3 scripts/mini1.py data/one_water_1.txt numerical
Convergence atteinte. Arrêt de l'optimisation.
Iteration 130 - GRMS: 9.827304249832638e-11
Énergie finale : 1.7770123251781158e-22 kcal/mol
Angle après minimisation : 104.5200 degrés
Longueur de liaison l1 après minimisation : 0.9572 Å
Longueur de liaison l2 après minimisation : 0.9572 Å
  1. Three water molecules energy minimisation with numerical gradient
python3 scripts/mini2.py data/three_waters.txt
Initial energy: 1002.61 kcal/mol.
Initial l_OH_1: 0.0954, 0.0966 Angstrom.
Initial theta_1: 104.03 degrees.
Initial l_OH_2: 0.0954, 0.0966 Angstrom.
Initial theta_2: 105.01 degrees.
Initial l_OH_3: 0.0954, 0.0966 Angstrom.
Initial theta_3: 104.87 degrees.
Final l_OH_1: 0.9572, 0.9572 Angstrom.
Final theta_1: 104.52 degrees.
Final l_OH_2: 0.9572, 0.9572 Angstrom.
Final theta_2: 104.52 degrees.
Final l_OH_3: 0.9572, 0.9572 Angstrom.
Final theta_3: 104.52 degrees.
Converged in 132 steps.
Energy after minimization: 6.220435904335795e-22 kcal/mol

steepest-descent's People

Contributors

zhukovanadezhda avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.