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

Update spahm-b #50

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft

Update spahm-b #50

wants to merge 9 commits into from

Conversation

YAY-C
Copy link
Contributor

@YAY-C YAY-C commented May 14, 2024

  • add same-basis option
  • implement single atom-type rep. generation and param
  • ecp argument for CLI parser
  • Add test
  • what about the --symbol option vs spahm-a(keep or remove)

(Closes #47)

@YAY-C YAY-C linked an issue May 14, 2024 that may be closed by this pull request
Copy link
Contributor Author

@YAY-C YAY-C left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining Issue:
How to deal with symbols and merging when saving reps (VS spahm-a)?

Comment on lines -39 to -50
def get_repr(mols, xyzlist, guess, xc=defaults.xc, spin=None, readdm=None,
pairfile=None, dump_and_exit=False,
bpath=defaults.bpath, cutoff=defaults.cutoff, omods=defaults.omod,
elements=None, only_m0=False, zeros=False, split=False, printlevel=0):

dms = utils.mols_guess(mols, xyzlist, guess,
xc=xc, spin=spin, readdm=readdm, printlevel=printlevel)
allvec = bond(mols, dms, bpath, cutoff, omods,
spin=spin, elements=elements,
only_m0=only_m0, zeros=zeros, split=split, printlevel=printlevel,
pairfile=pairfile, dump_and_exit=dump_and_exit)
return allvec
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what this function is used for ?

maybe a left-over from before bond()??

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look in the master branch main() calls get_repr() and get_repr() calls bond().
I think the idea was to have an inner function that doesn't compute the guess, just the representation.
I would rather split spahm(a) in the same manner

Comment on lines 110 to +121
if args.spin:
if args.merge is False:
for omod, vec in zip(args.omod, allvec):
if args.with_symbols: allvec = np.array([(z, v) for v,z in zip(allvec, all_atoms)], dtype=object)
np.save(args.name_out+'_'+omod, vec)
else:
np.save(args.name_out+'_'+'_'.join(args.omod), np.hstack(allvec))
allvec = np.hstack(allvec)
if args.with_symbols: allvec = np.array([(z, v) for v,z in zip(allvec, all_atoms)], dtype=object)
np.save(args.name_out+'_'+'_'.join(args.omod), allvec)
else:
np.save(args.name_out, allvec)

if args.with_symbols: allvec = np.array([(z, v) for v,z in zip(allvec, all_atoms)], dtype=object)
np.save(args.name_out+'_'+'_'.join(args.omod), allvec)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part is a bit convoluted!

The default (and only) behaviour in spahm-a is to always return tuple (symbols, reps, omod) and then the main() deals with the merging. and there's no option to save without symbols

  • maybe it's worth following spahm-a idea where the specific function for each local rep returns the tuple (with everything separated) and let the main() function deal with the symbols and the merging options.
    What do you think?

Copy link
Contributor

@briling briling May 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it should be in main(). Can be in get_repr() that you removed.
The function can be run from a python script so almost everything meaningful should be in functions

@@ -68,12 +62,15 @@ def main():
parser.add_argument('--zeros', action='store_true', dest='zeros', default=False, help='use a version with more padding zeros')
parser.add_argument('--split', action='store_true', dest='split', default=False, help='split into molecules')
parser.add_argument('--merge', action='store_true', dest='merge', default=True, help='merge different omods')
parser.add_argument('--symbols', action='store_true', dest='with_symbols', default=False, help='if save tuples with (symbol, vec) for all atoms')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe make it a --nosymbols option instead. (see comment below)

@YAY-C YAY-C requested a review from briling May 14, 2024 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

update_spahm-b
2 participants