Skip to content

Commit c835825

Browse files
charmm force field develeopment based on Monte Carlo simulation
1 parent bf7ee4b commit c835825

File tree

129 files changed

+617027
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+617027
-2
lines changed

2D_generate_histogram.py

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/usr/bin/python
2+
"""
3+
Script: 2D_generate_histogram.py
4+
Author: Asaminew Aytenfisu
5+
Description: This script generates a histogram from data points.
6+
"""
7+
8+
import argparse
9+
import sys
10+
import math
11+
import numpy as np
12+
13+
def read_angles(line):
14+
tokens = line.split()
15+
x = float(tokens[0])
16+
y = float(tokens[1])
17+
return [x, y]
18+
19+
def main(args):
20+
try:
21+
data_file = args.data_file
22+
histogram_file = args.histogram_file
23+
x_min = args.x_min
24+
x_max = args.x_max
25+
y_min = args.y_min
26+
y_max = args.y_max
27+
x_resolution = args.x_resolution
28+
y_resolution = args.y_resolution
29+
30+
points = [read_angles(line) for line in open(data_file)]
31+
count = len(points)
32+
histogram = np.zeros([x_resolution, y_resolution])
33+
x_interval_length = (x_max - x_min) / x_resolution
34+
y_interval_length = (y_max - y_min) / y_resolution
35+
interval_surface = x_interval_length * y_interval_length
36+
increment = count / interval_surface
37+
38+
for i in points:
39+
x = int((i[0] - x_min) / x_interval_length)
40+
y = int((i[1] - y_min) / y_interval_length)
41+
histogram[x,y] += increment
42+
43+
x_intervals = np.arange(x_min, x_max, (x_max - x_min) / x_resolution)
44+
y_intervals = np.arange(y_min, y_max, (y_max - y_min) / y_resolution)
45+
46+
with open(histogram_file, 'w') as o:
47+
for i, x in enumerate(x_intervals):
48+
for j, y in enumerate(y_intervals):
49+
if histogram[i,j] != 0.0:
50+
o.write('%f %f %f \n' % (x, y, -0.001982923700*298.0*math.log(histogram[i,j]/histogram.max())))
51+
else:
52+
o.write('%f %f %f \n' % (x, y, 99999.0))
53+
o.write('\n')
54+
55+
except Exception as e:
56+
print("Error:", e)
57+
sys.exit(1)
58+
59+
if __name__ == "__main__":
60+
parser = argparse.ArgumentParser(description="Generate a histogram from data points")
61+
parser.add_argument("data_file", help="input data file")
62+
parser.add_argument("histogram_file", help="output histogram file")
63+
parser.add_argument("x_min", type=float, help="minimum x value")
64+
parser.add_argument("x_max", type=float, help="maximum x value")
65+
parser.add_argument("y_min", type=float, help="minimum y value")
66+
parser.add_argument("y_max", type=float, help="maximum y value")
67+
parser.add_argument("x_resolution", type=int, help="x resolution")
68+
parser.add_argument("y_resolution", type=int, help="y resolution")
69+
args = parser.parse_args()
70+
main(args)

README.md

+37-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,37 @@
1-
# RNA-structure
2-
Will be used for RNA and related structure prediction
1+
# RNA and related tools and codes
2+
3+
4+
## Table of Contents
5+
6+
- [Project Name](#project-name)
7+
- [Table of Contents](#table-of-contents)
8+
- [About](#about)
9+
- [Features](#features)
10+
- [Installation](#installation)
11+
- [Usage](#usage)
12+
- [Contributing](#contributing)
13+
- [License](#license)
14+
15+
## About
16+
17+
Provide more detailed information about the project. What is its purpose? Why was it created? Who is the intended audience?
18+
19+
## Features
20+
21+
List the key features of the project. What functionalities does it offer? What problems does it solve?
22+
23+
## Installation
24+
25+
Provide step-by-step instructions on how to install and set up the project. Include any prerequisites or dependencies.
26+
27+
## Usage
28+
29+
Explain how to use the project. Provide examples, code snippets, or screenshots if applicable.
30+
31+
## Contributing
32+
33+
Outline guidelines for contributing to the project. How can others contribute? What types of contributions are welcome?
34+
35+
## License
36+
37+
Specify the license under which the project is distributed. Include any terms and conditions.

charmm-mcsa/.DS_Store

6 KB
Binary file not shown.

0 commit comments

Comments
 (0)