Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug with Lr leading to an #69

Merged
merged 4 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Unit conversion for (currenly unused) vdW radii from the original Fortran project
- minor print output issues (no new line breaks, more consistent verbosity differentiation, ...)
- bug in `postprocess_mol` which led to an unassigned return variable in the single-point case
- bug with all atom lists being initialized with a length of 102 instead of 103

### Added
- Support for the novel "g-xTB" method (working title: GP3-xTB)
Expand Down
4 changes: 2 additions & 2 deletions src/mindlessgen/molecules/generate_molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ def generate_atom_list(cfg: GenerateConfig, verbosity: int = 1) -> np.ndarray:
valid_elems = set_all_elem

natoms = np.zeros(
102, dtype=int
) # 102 is the number of accessible elements in the periodic table
103, dtype=int
) # 103 is the number of accessible elements in the periodic table

# Some sanity checks:
# - Check if the minimum number of atoms is smaller than the maximum number of atoms
Expand Down
2 changes: 1 addition & 1 deletion src/mindlessgen/molecules/molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ def read_xyz_from_file(self, filename: str | Path) -> None:
# read the atomic coordinates
self.xyz = np.zeros((self.num_atoms, 3))
self.ati = np.zeros(self.num_atoms, dtype=int)
self.atlist = np.zeros(102, dtype=int)
self.atlist = np.zeros(103, dtype=int)
for i in range(self.num_atoms):
line = lines[i + 2].split()
self.ati[i] = PSE_NUMBERS[line[0].lower()] - 1
Expand Down
2 changes: 1 addition & 1 deletion src/mindlessgen/molecules/refinement.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def detect_fragments(
# Remove the atoms that are not in the fragment from ati
fragment_molecule.ati = np.array([mol.ati[i] for i in fragment])
# Update atlist by going through ati and add the occurences of each atom onto an empty array
fragment_molecule.atlist = np.zeros(102, dtype=int)
fragment_molecule.atlist = np.zeros(103, dtype=int)
for atom in fragment_molecule.ati:
fragment_molecule.atlist[atom] += 1
# Update the charge of the fragment molecule
Expand Down
4 changes: 3 additions & 1 deletion src/mindlessgen/prog/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,9 @@ def check_config(self, verbosity: int = 1) -> None:
for elem in self.generate.element_composition
):
warnings.warn(
"f-block elements could be within the molecule. xTB does not treat f electrons explicitly. In this case UHF is set to 0."
"f-block elements could be within the molecule. "
+ "xTB does not treat f electrons explicitly. "
+ "UHF is temporarily set to 0."
)

# Check for super heavy elements in forbidden elements
Expand Down
2 changes: 1 addition & 1 deletion test/test_generate/test_generate_molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_generate_atom_list(min_atoms, max_atoms, default_generate_config):

# Common assertions for atom count range
assert isinstance(atom_list, np.ndarray)
assert atom_list.shape == (102,)
assert atom_list.shape == (103,)
assert np.sum(atom_list) > 0
assert np.sum(atom_list) >= min_atoms
assert np.sum(atom_list) <= max_atoms
Expand Down