Skip to content

Commit 6295254

Browse files
Added the path to the FF, psf, and pdb file to be selected by the user. Moved restart variables to the required variables, and added the ability to use new restart input files. (#937)
* Added functionallity and tests to select any desired path to be written for the gomc_controlfile_writer. This include a default check to see if the FF, psf, and pdb files exist in the specified path, but this can also be overridden. This will allow may simulation to be run from 1 existing system build and FF file. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fixed some spacing issues int the gomc_conf_writer.py docstrings. * Fixed some spacing issues int the gomc_conf_writer.py docstrings rev 1 * Fixed some spacing issues int the gomc_conf_writer.py docstrings rev 2 * Fixed some spacing issues int the gomc_conf_writer.py docstrings rev 3 * Fixed some spacing issues int the gomc_conf_writer.py docstrings rev 4 * Fixed some spacing issues int the gomc_conf_writer.py docstrings rev 4 * Fixed some spacing issues int the gomc_conf_writer.py docstrings rev 5 * added gomc file input directory changes, full path changes, and checking if files exist. Before, the gomc input file had to be in the same directory. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * reformated restart and restartcheckpoint to required variables. Added binCoordinates, extendedSystem, and binVelocities as options to restart the simulations. Added overrides for Coordinates_box and Structure_box in the required variables. Renamed alot of the new required variables. This is in the gomc_conf_writer.py * reformated restart and restartcheckpoint to required variables. Added binCoordinates, extendedSystem, and binVelocities as options to restart the simulations. Added overrides for Coordinates_box and Structure_box in the required variables. Renamed alot of the new required variables. This is in the gomc_conf_writer.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * removed extra coordinate and structure descriptions in the attributes of the gomc_conf_writer.py * added more tests for the gomc_conf_writer. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * added more test cases to the gomc_conf_writer.py, specificly the new input file path and file overrides and new restart variable moved to the required variables. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * improved variable text descriptions * Fixed an few errors. One which didnt allow the structure paths to be changed without the coordinate paths, so now either or can be overridden. Second, allows only the pdb and psf files to be used to restart the simulation, but these will need to be the GOMC output files. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fixed areas of the code to accept .par files for the FF files along with the current .inp files. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * added test for the parameters for .inp and .par files fo rthe gomc_conf_writer.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * added check_input_files_exist check int eh test_gomc_conf_writer.py file. * added the default file name and directory to the docstrings for the parameter, coordinate, and structure files in the gomc_conf_writer.py file. * fixed a mislabed variable in place for the charmm_writer.py file (residue_id_list to structure_box_0_and_1_ff), which likely got autochanged by accident * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * added line to fix potenial bug in unique atom name writers (unique_atom_naming function) * The OutMolNumber variable is wrong and changed to the correct OutMolNum variable. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fixed typo and removed a few undeeded if statements per the review comments. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fixed typo * added a sorting function for the input_variables_dict gomc_writer input, which removes checking variables that are set as none. Therefore, these variables are just set to the defaults, like they were never entered. Otherwise, they are checked and dont match the required input varible formats and will not provide informative errors for the users. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: bc118 <crawfordb118@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 5c3cec1 commit 6295254

File tree

3 files changed

+3143
-593
lines changed

3 files changed

+3143
-593
lines changed

mbuild/formats/charmm_writer.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ def _get_bond_type_key(
4949
bond_atom_2_residue_name : str
5050
The residue name for atom 2 in the bond.
5151
"""
52-
5352
bond_k_constant = round(
5453
bond.type.k
5554
* (sigma_conversion_factor ** 2 / epsilon_conversion_factor),
@@ -947,6 +946,7 @@ def unique_atom_naming(
947946
elif len(str(atom.name)) > 2:
948947
if len(str(atom.name)) == 3:
949948
no_digits_atom_name = 1
949+
atom_name_value = atom.name
950950
else:
951951
text_to_write = (
952952
"ERROR: atom numbering will not work propery at"
@@ -1800,7 +1800,7 @@ def __init__(
18001800
boxes_for_simulation=self.boxes_for_simulation,
18011801
)
18021802

1803-
self.residue_id_list = (
1803+
self.structure_box_0_and_1_ff = (
18041804
self.structure_box_0_ff + self.structure_box_1_ff
18051805
)
18061806
self.combined_1_4_lj_dict_per_residue.update(
@@ -1865,7 +1865,9 @@ def __init__(
18651865
"Total charge is {}.".format(total_charge)
18661866
)
18671867

1868-
total_charge = sum([atom.charge for atom in self.residue_id_list])
1868+
total_charge = sum(
1869+
[atom.charge for atom in self.structure_box_0_and_1_ff]
1870+
)
18691871
if round(total_charge, 4) != 0.0:
18701872
warn(
18711873
"System is not charge neutral for structure_0_and_1. "
@@ -1962,7 +1964,7 @@ def __init__(
19621964
self.types = np.array(
19631965
[
19641966
atom.type + "_" + str(atom.residue.name)
1965-
for atom in self.residue_id_list.atoms
1967+
for atom in self.structure_box_0_and_1_ff.atoms
19661968
]
19671969
)
19681970

@@ -1979,7 +1981,9 @@ def __init__(
19791981

19801982
if self.structure_box_1:
19811983
self.masses = (
1982-
np.array([atom.mass for atom in self.residue_id_list.atoms])
1984+
np.array(
1985+
[atom.mass for atom in self.structure_box_0_and_1_ff.atoms]
1986+
)
19831987
/ self.mass_conversion_factor
19841988
)
19851989
self.mass_dict = dict(
@@ -2060,7 +2064,7 @@ def __init__(
20602064

20612065
# if self.structure_box_1 != None:
20622066
if self.structure_box_1:
2063-
self.structure_selection = self.residue_id_list
2067+
self.structure_selection = self.structure_box_0_and_1_ff
20642068
else:
20652069
self.structure_selection = self.structure_box_0_ff
20662070

0 commit comments

Comments
 (0)