forked from RascalSoftware/python-RAT
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconvert_rascal.py
More file actions
49 lines (35 loc) · 1.56 KB
/
convert_rascal.py
File metadata and controls
49 lines (35 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
"""An example of how to convert a RasCAL-1 project to RAT."""
import pathlib
from pprint import pp
import ratapi as RAT
# convert R1 project to Project class
def convert_rascal(mat_filename="lipid_bilayer.mat"):
"""Convert a project from RasCAL-1 and a project to RasCAL-1.
We convert a RasCAL-1 monolayer volume model to RAT, and the DSPC Standard Layers
example to RasCAL-1.
Parameters
----------
mat_filename : str
The filename of the output of the RAT project converted to RasCAL-2.
Returns
-------
project, struct
A RasCAL-1 monolayer volume model converted to a RAT project, and the
struct of the DSPC standard layers example converted to a RasCAL-1 struct.
"""
project_path = pathlib.Path(__file__).parent / "R1monolayerVolumeModel.mat"
project = RAT.utils.convert.r1_to_project(project_path)
# change values if you like, including ones not supported by R1
project.parameters["Head Thickness"].prior_type = "gaussian"
project.parameters["Theta"].mu = 2.0
project.parameters["Area per molecule"].sigma = 50.0
# convert DSPC standard layers example to a struct and save as file
lipid_bilayer_project = RAT.examples.DSPC_standard_layers()[0]
RAT.utils.convert.project_to_r1(lipid_bilayer_project, filename=mat_filename)
# convert and return as a Python dictionary
struct = RAT.utils.convert.project_to_r1(lipid_bilayer_project, return_struct=True)
return project, struct
if __name__ == "__main__":
project, struct = convert_rascal()
print(project)
pp(struct)