def from_refatoms(cls, numbers=None, max_kation=3, max_anion=2, agspec='fine'): ''' Construct a ProAtomDB from reference atoms included in HORTON **Arguments:** fns_chk A list of HORTON checkpoint files. **Optional Arguments:** numbers A list of atom numbers to limit the selection of atoms in the database. When not given, all reference atoms are loaded. max_kation The charge of the most positive kation to include max_anion Minus the charge of the most negativ anion to include. (This is typically a positive argument.) agspec A specifications of the atomic grid. This can either be an instance of the AtomicGridSpec object, or the first argument of its constructor. ''' # Search for all the relevant .h5 files of built-in reference atoms fns_chk = [] for fn in context.glob('refatoms/*.h5'): name = os.path.basename(fn) number = int(name[:3]) if not (numbers is None or number in numbers): continue pop = int(name[8:10]) charge = number - pop if charge > max_kation or charge < -max_anion: continue fns_chk.append(fn) # Hand them over to another constructor return cls.from_files(fns_chk, agspec)
def from_refatoms(cls, numbers=None, max_cation=3, max_anion=2, agspec='fine'): ''' Construct a ProAtomDB from reference atoms included in HORTON **Arguments:** fns_chk A list of HORTON checkpoint files. **Optional Arguments:** numbers A list of atom numbers to limit the selection of atoms in the database. When not given, all reference atoms are loaded. max_cation The charge of the most positive cation to include max_anion Minus the charge of the most negativ anion to include. (This is typically a positive argument.) agspec A specifications of the atomic grid. This can either be an instance of the AtomicGridSpec object, or the first argument of its constructor. ''' # Search for all the relevant .h5 files of built-in reference atoms fns_chk = [] for fn in context.glob('refatoms/*.h5'): name = os.path.basename(fn) number = int(name[:3]) if not (numbers is None or number in numbers): continue pop = int(name[8:10]) charge = number - pop if charge > max_cation or charge < -max_anion: continue fns_chk.append(fn) # Hand them over to another constructor return cls.from_files(fns_chk, agspec)