imce 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- imce/__about__.py +20 -0
- imce/__init__.py +104 -0
- imce/analysis.py +988 -0
- imce/energy.py +323 -0
- imce/simulation.py +531 -0
- imce/structure.py +453 -0
- imce/units.py +54 -0
- imce/utility.py +1564 -0
- imce-1.0.0.dist-info/METADATA +130 -0
- imce-1.0.0.dist-info/RECORD +14 -0
- imce-1.0.0.dist-info/WHEEL +5 -0
- imce-1.0.0.dist-info/licenses/COPYING +675 -0
- imce-1.0.0.dist-info/licenses/COPYING.LESSER +165 -0
- imce-1.0.0.dist-info/top_level.txt +1 -0
imce/__about__.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'''
|
|
2
|
+
This file is part of imce - a simple framework for molecular Monte Carlo sampling with uncertainty quantification.
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2021 - 2026 Erik Tsvetaev and Christoph Jacob.
|
|
5
|
+
|
|
6
|
+
imce is free software: you can redistribute it and/or modify it under
|
|
7
|
+
the terms of the GNU Lesser General Public License as published by
|
|
8
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
(at your option) any later version.
|
|
10
|
+
|
|
11
|
+
imce is distributed in the hope that it will be useful,
|
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
GNU Lesser General Public License for more details.
|
|
15
|
+
|
|
16
|
+
You should have received a copy of the GNU Lesser General Public License
|
|
17
|
+
along with imce. If not, see <https://www.gnu.org/licenses/>.
|
|
18
|
+
'''
|
|
19
|
+
|
|
20
|
+
__version__ = '1.0.0'
|
imce/__init__.py
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
'''
|
|
2
|
+
This file is part of imce - a simple framework for molecular Monte Carlo sampling with uncertainty quantification.
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2021 - 2026 Erik Tsvetaev and Christoph Jacob.
|
|
5
|
+
|
|
6
|
+
imce is free software: you can redistribute it and/or modify it under
|
|
7
|
+
the terms of the GNU Lesser General Public License as published by
|
|
8
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
(at your option) any later version.
|
|
10
|
+
|
|
11
|
+
imce is distributed in the hope that it will be useful,
|
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
GNU Lesser General Public License for more details.
|
|
15
|
+
|
|
16
|
+
You should have received a copy of the GNU Lesser General Public License
|
|
17
|
+
along with imce. If not, see <https://www.gnu.org/licenses/>.
|
|
18
|
+
'''
|
|
19
|
+
|
|
20
|
+
from pathlib import Path
|
|
21
|
+
from importlib.resources import files
|
|
22
|
+
import logging
|
|
23
|
+
|
|
24
|
+
from imce.structure import simbox
|
|
25
|
+
from imce.simulation import mrt2, uqmc
|
|
26
|
+
from imce.energy import xtb_std2_itrf
|
|
27
|
+
from imce.analysis import analysis
|
|
28
|
+
|
|
29
|
+
import numpy as np
|
|
30
|
+
|
|
31
|
+
def home() -> Path:
|
|
32
|
+
return Path(files("imce")).resolve()
|
|
33
|
+
|
|
34
|
+
logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)s", handlers=[logging.StreamHandler()])
|
|
35
|
+
|
|
36
|
+
class settings:
|
|
37
|
+
'''
|
|
38
|
+
This class holds the generic data for the simulation, that can be accessed from any other class.
|
|
39
|
+
|
|
40
|
+
It should be defined at the beginning of each run
|
|
41
|
+
script and will be handed over to every simulation etc.
|
|
42
|
+
'''
|
|
43
|
+
|
|
44
|
+
def __init__(self, itrf, windows = [[]], seed = None, unit = 'eV', convolution_factor = None):
|
|
45
|
+
'''
|
|
46
|
+
The unit system that the code runs on. Can be either au, eV, nm or cm-1.
|
|
47
|
+
'''
|
|
48
|
+
|
|
49
|
+
from .units import au_to_ev, au_to_nm, au_to_cm1, ev_to_au, cm1_to_au
|
|
50
|
+
|
|
51
|
+
self.create_generator(seed = seed)
|
|
52
|
+
self.itrf = itrf
|
|
53
|
+
self.unit = unit # this decides, in which unit the windows, convolution factors and so on are given in
|
|
54
|
+
|
|
55
|
+
if self.unit == 'cm-1':
|
|
56
|
+
self.convert_to_input = cm1_to_au
|
|
57
|
+
self.convert_to_output = au_to_cm1
|
|
58
|
+
elif self.unit == 'nm':
|
|
59
|
+
self.convert_to_input = nm_to_au
|
|
60
|
+
self.convert_to_output = au_to_nm
|
|
61
|
+
elif self.unit == 'eV':
|
|
62
|
+
self.convert_to_input = ev_to_au
|
|
63
|
+
self.convert_to_output = au_to_ev
|
|
64
|
+
elif self.unit == 'au':
|
|
65
|
+
self.convert_to_input = lambda au : au
|
|
66
|
+
self.convert_to_output = lambda au : au
|
|
67
|
+
else:
|
|
68
|
+
raise imceError('Unit not known')
|
|
69
|
+
|
|
70
|
+
self.windows = self.convert_to_input(windows)
|
|
71
|
+
|
|
72
|
+
if convolution_factor is not None:
|
|
73
|
+
self.convolution_factor = self.convert_to_input(convolution_factor)
|
|
74
|
+
else:
|
|
75
|
+
self.convolution_factor = None
|
|
76
|
+
|
|
77
|
+
self.itrf.set_convolution_factor(self.convolution_factor)
|
|
78
|
+
|
|
79
|
+
def get_windows(self):
|
|
80
|
+
return self.windows
|
|
81
|
+
|
|
82
|
+
def get_convolution_factor(self):
|
|
83
|
+
return self.convolution_factor
|
|
84
|
+
|
|
85
|
+
def create_generator(self, seed=None):
|
|
86
|
+
'''
|
|
87
|
+
This sets the statistical generator used for MC and MD, velocity generation, etc.
|
|
88
|
+
|
|
89
|
+
If a seed is given, the value will be used. If no seed is given, this function generates a random integer and
|
|
90
|
+
feeds that into a generator. This is done, so that always one single quotable seed is available to
|
|
91
|
+
reproduce the simulation and compare different versions of the code.
|
|
92
|
+
'''
|
|
93
|
+
self.seed = seed
|
|
94
|
+
|
|
95
|
+
if seed is not None:
|
|
96
|
+
self.generator = np.random.default_rng(seed)
|
|
97
|
+
elif seed is None:
|
|
98
|
+
self.seed = np.random.randint(0, 2147483648) # Minimum and maximum of a python integer
|
|
99
|
+
self.generator = np.random.default_rng(self.seed)
|
|
100
|
+
else:
|
|
101
|
+
raise imceError('Something is not right')
|
|
102
|
+
|
|
103
|
+
def get_generator(self):
|
|
104
|
+
return self.generator
|