Skip to content

Commit

Permalink
remove some unused attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjonesBSU committed Feb 25, 2024
1 parent 2998a23 commit cc50a4f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 41 deletions.
12 changes: 2 additions & 10 deletions msibi/forces.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,9 @@ def __init__(
self.x_range = None
self.potential_history = []
self._potential = None
#TODO: Remove this attr?
self._potential_file = None
self._smoothing_window = 3
self._smoothing_order = 1
self._nbins = nbins
self._force_type = None #TODO: Do we need this?
self._states = dict()
self._head_correction_history = []
self._tail_correction_history = []
Expand Down Expand Up @@ -253,7 +250,7 @@ def set_quadratic(self, k4, k3, k2, x0, x_min, x_max):
self.x_min = x_min
self.x_max = x_max
self.dx = x_max / self.nbins
self.x_range = np.arange(x_min, x_max+self.dx, self.dx)
self.x_range = np.arange(x_min, x_max + self.dx, self.dx)
self.potential = quadratic_spring(self.x_range, x0, k4, k3, k2)
self.force_init = "Table"
self.force_entry = self._table_entry()
Expand All @@ -277,8 +274,7 @@ def set_from_file(self, file_path):
run to set a static coarse-grained bond potential while you perform
IBI runs on angle and/or pair potentials.
"""
self._potential_file = file_path
f = np.loadtxt(self._potential_file)
f = np.loadtxt(file_path)
self.x_range = f[:,0]
self.dx = np.round(self.x_range[1] - self.x_range[0], 3)
self.x_min = self.x_range[0]
Expand Down Expand Up @@ -405,7 +401,6 @@ def __init__(
self.type1, self.type2 = sorted(
[type1, type2], key=natural_sort
)
self._force_type = "bond"
self._correction_function = bond_correction
name = f"{self.type1}-{self.type2}"
super(Bond, self).__init__(
Expand Down Expand Up @@ -475,7 +470,6 @@ def __init__(
self.type2 = type2
self.type3 = type3
name = f"{self.type1}-{self.type2}-{self.type3}"
self._force_type = "angle"
self._correction_function = bond_correction
super(Angle, self).__init__(
name=name,
Expand Down Expand Up @@ -537,7 +531,6 @@ def __init__(
):
self.type1, self.type2 = sorted( [type1, type2], key=natural_sort)
name = f"{self.type1}-{self.type2}"
self._force_type = "pair"
self.r_cut = None
super(Pair, self).__init__(
name=name,
Expand Down Expand Up @@ -593,7 +586,6 @@ def __init__(
self.type3 = type3
self.type4 = type4
name = f"{self.type1}-{self.type2}-{self.type3}-{self.type4}"
self._force_type = "dihedral"
self.table_entry = dict(U=None, tau=None)
super(Dihedral, self).__init__(
name=name,
Expand Down
33 changes: 2 additions & 31 deletions msibi/optimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,9 @@ def run_optimization(
backup_trajectories : bool, optional default False
If True, copies of the query simulation trajectories
are saved in their respective msibi.state.State directory.
"""
#self._initialize(potentials_dir=_dir)

for n in range(n_iterations):
print(f"---Optimization: {n+1} of {n_iterations}---")
for state in self.states:
Expand Down Expand Up @@ -224,33 +225,3 @@ def _recompute_distribution(self, force):
)
)
print()
#TODO: Delete this?
def _initialize(self, potentials_dir):
"""Create initial table potentials and the simulation input scripts.
Parameters
----------
potentials_dir : path, default None
Directory to store potential files. If None is given, a "potentials"
folder in the current working directory is used.
"""
if potentials_dir is None:
self.potentials_dir = os.path.join(os.getcwd(), "potentials")
else:
self.potentials_dir = potentials_dir

if not os.path.isdir(self.potentials_dir):
os.mkdir(self.potentials_dir)
for force in self.forces:
if force.format == "table" and force.optimize:
potential_file = os.path.join(
self.potentials_dir, f"{force.name}.txt"
)
force._potential_file = potential_file
save_table_potential(
force.potential,
force.x_range,
force.dx,
0,
force._potential_file
)

0 comments on commit cc50a4f

Please sign in to comment.