Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
8f50fe8
added comments and added to density.py
coreen-mullen Jun 30, 2025
04a8e22
Editing density.py
coreen-mullen Jul 1, 2025
664fd68
Error fixing
ratzho Aug 5, 2025
0a5888d
resolve merge conflicts
ratzho Aug 6, 2025
19734cd
editing test
coreen-mullen Aug 11, 2025
9978153
'added base for ensemble score'
coreen-mullen Sep 4, 2025
60864da
Save local changes before merging
coreen-mullen Sep 5, 2025
b32df65
Save local changes before merging
coreen-mullen Sep 5, 2025
76a70a9
Resolved merge conflicts
coreen-mullen Sep 5, 2025
fd3d3cb
update scoring.py
coreen-mullen Sep 5, 2025
2f212f9
Merge branch 'develop' into develop
coreen-mullen Sep 8, 2025
4577d51
merging remote
ratzho Sep 8, 2025
55b5523
adding untracked files and adding edited testing.py
ratzho Sep 8, 2025
4377e7a
concluded all commits
ratzho Sep 9, 2025
649d3fd
fixing merge errors
ratzho Sep 9, 2025
1ca6783
Merge branch 'pr-branch' into develop
ratzho Sep 17, 2025
1eb24a0
Updating ensemble score.
ratzho Sep 24, 2025
506a561
updating ensemble
ratzho Sep 25, 2025
1c9bdcc
test
coreen-mullen Sep 25, 2025
81e93b6
adding hard coded target_var to fix error
coreen-mullen Sep 30, 2025
f408966
Merge branch 'develop' of https://github.com/FitSNAP/structure-genera…
coreen-mullen Oct 1, 2025
2c5dd56
'deleting extra testing files.'
coreen-mullen Oct 1, 2025
9ac0112
Delete .gitignore
coreen-mullen Oct 2, 2025
17e27d2
adding files
coreen-mullen Oct 3, 2025
918d59d
editing GRS.py
coreen-mullen Oct 6, 2025
c54c4c3
removing files from pr
coreen-mullen Oct 7, 2025
340603a
removing extra files in pr
coreen-mullen Oct 7, 2025
a421c16
removing extra file in pr
coreen-mullen Oct 7, 2025
ecfb58d
removing extra files in pr
coreen-mullen Oct 7, 2025
b6ca578
removing extra files in pr
coreen-mullen Oct 7, 2025
09016ed
fixing pr
coreen-mullen Oct 7, 2025
fc73b14
fixing pr
coreen-mullen Oct 7, 2025
30fbb6b
removing extra file in pr
coreen-mullen Oct 7, 2025
cf6d166
removing extra file in pr
coreen-mullen Oct 7, 2025
0b8f8c6
removing extra file in pr
coreen-mullen Oct 7, 2025
83e55cc
removing extra file in pr
coreen-mullen Oct 7, 2025
cc9a95d
removing extra file in pr
coreen-mullen Oct 7, 2025
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
21 changes: 0 additions & 21 deletions .gitignore

This file was deleted.

61 changes: 45 additions & 16 deletions GRSlib/GRS.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from GRSlib.parallel_tools import ParallelTools
from GRSlib.io.input import Config
from GRSlib.converters.convert_factory import convert
from GRSlib.motion.scoring import Scoring, elems, get_desc_count
from GRSlib.motion.scoring_factory import scoring
from GRSlib.motion.motion import Gradient, Genetic
from GRSlib.motion.scoring import Scoring
from GRSlib.motion.motion import Gradient, Optimize, Create

import random, copy, os, glob, shutil
import numpy as np

Expand Down Expand Up @@ -165,6 +166,38 @@ def get_score(self,data):
raise RuntimeError(">>> Found unmatched BASIS for target and current descriptors")

return score
def get_ensemble(self,data):
print("get ensemble called.")
print("Using elems:",elems)
print("Ensemble Target")
scores=None
try:
scores = self.score.ensemble_score(
n_totconfig=10, # Example value
data_path='bcc.data', # Example value
cross_weight=1.0,
self_weight=1.0,
randomize_comps=False,
mincellsize=54,
maxcellsize=55,
target_comps={'W': 1.0}, # Ensure this is a dictionary
min_typ_global='box',
soft_strength=0.0,
nelements=len(elems), # Ensure elems is defined
n_descs=get_desc_count('coupling_coefficients.yace'),
mask=None, # Set this as needed
rand_comp=1)
print("Scores returned from ensemble_score:", scores)
except Exception as e:
print(f"An error occurred while calculating the ensemble score: {e}")
return None # Optionally return None or handle the error as needed
# Check if score was calculated
if scores is None or len(scores) == 0:
print("No scores were calculated returning None")
raise RuntimeError("Ensemble score could not be calculated.")

return scores # Ensure you return the score
#""" self.score = Scoring(data, self.current_desc, self.target_desc, self.prior_desc, self.pt, self.config)score = self.score.ensemble_score() return score"""

def propose_structure(self):
"""
Expand All @@ -187,21 +220,17 @@ def genetic_move(self,data):
#3) Hybridize, Mutate based on set of rules and probabilities
#4) Store socring information with best-of-generation and best-overall isolated
#5) Loop until generation limit or scoring residual below threshold
if data == None:
data = self.propose_structure()
self.descriptors['current']= self.convert_to_desc(data)
try:
self.descriptors['target'] = np.load(self.config.sections['TARGET'].target_fdesc)
except:
self.descriptors['target'] = self.convert_to_desc(self.config.sections['TARGET'].target_fname)

self.score = Scoring(self.pt, self.config, self.loss_func, data, self.descriptors) # Set scoring class to assign scores to moves
self.genmove = Optimize(self.pt, self.config, self.score) #Set desired motion class with scoring attached


#self.genmove.tournament_selection()
#for iterations in top_candidates[1], convert.ase_to_lammps
#self.write_output()
print("Called Genetic_Move")
if self.current_desc is None:
self.current_desc = self.propose_structure()
#if data == None:
#data = self.propose_structure()

self.descriptors['current'] = self.convert_to_desc(data)
self.descriptors['target'] = self.convert_to_desc(self.config.sections['TARGET'].target_fname)
self.genmove = Genetic(self.pt, self.config, data, self.descriptors)
#Dont want to make a func call the default here since the user will define this?
#Need a fallback to provide a good default if a genetic move is called.

# @self.pt.single_timeit
def gradient_move(self,data):
Expand Down
Loading