def main(): args = parse_args() fn_h5, grp_name = parse_h5(args.output, 'output') # check if the group is already present (and not empty) in the output file if check_output(fn_h5, grp_name, args.overwrite): return # Load the cost function from the HDF5 file cost, used_volume = load_cost(args.cost) # Find the optimal charges results = {} results['x'] = cost.solve(args.qtot, args.ridge) results['charges'] = results['x'][:cost.natom] # Related properties results['cost'] = cost.value(results['x']) if results['cost'] < 0: results['rmsd'] = 0.0 else: results['rmsd'] = (results['cost'] / used_volume)**0.5 # Worst case stuff results['cost_worst'] = cost.worst(0.0) if results['cost_worst'] < 0: results['rmsd_worst'] = 0.0 else: results['rmsd_worst'] = (results['cost_worst'] / used_volume)**0.5 # Write some things on screen if log.do_medium: log('Important parameters:') log.hline() log('RMSD charges: %10.5e' % np.sqrt( (results['charges']**2).mean())) log('RMSD ESP: %10.5e' % results['rmsd']) log('Worst RMSD ESP: %10.5e' % results['rmsd_worst']) log.hline() # Perform a symmetry analysis if requested if args.symmetry is not None: mol_pot = IOData.from_file(args.symmetry[0]) mol_sym = IOData.from_file(args.symmetry[1]) if not hasattr(mol_sym, 'symmetry'): raise ValueError('No symmetry information found in %s.' % args.symmetry[1]) aim_results = {'charges': results['charges']} sym_results = symmetry_analysis(mol_pot.coordinates, mol_pot.cell, mol_sym.symmetry, aim_results) results['symmetry'] = sym_results # Store the results in an HDF5 file write_script_output(fn_h5, grp_name, results, args)
def main(): args = parse_args() fn_h5, grp_name = parse_h5(args.output, 'output') # check if the group is already present (and not empty) in the output file if check_output(fn_h5, grp_name, args.overwrite): return # Load the cost function from the HDF5 file cost, used_volume = load_cost(args.cost) # Find the optimal charges results = {} results['x'] = cost.solve(args.qtot, args.ridge) results['charges'] = results['x'][:cost.natom] # Related properties results['cost'] = cost.value(results['x']) if results['cost'] < 0: results['rmsd'] = 0.0 else: results['rmsd'] = (results['cost']/used_volume)**0.5 # Worst case stuff results['cost_worst'] = cost.worst(0.0) if results['cost_worst'] < 0: results['rmsd_worst'] = 0.0 else: results['rmsd_worst'] = (results['cost_worst']/used_volume)**0.5 # Write some things on screen if log.do_medium: log('Important parameters:') log.hline() log('RMSD charges: %10.5e' % np.sqrt((results['charges']**2).mean())) log('RMSD ESP: %10.5e' % results['rmsd']) log('Worst RMSD ESP: %10.5e' % results['rmsd_worst']) log.hline() # Perform a symmetry analysis if requested if args.symmetry is not None: sys = System.from_file(args.symmetry[0]) sys_sym = System.from_file(args.symmetry[1]) sym = sys_sym.extra.get('symmetry') if sym is None: raise ValueError('No symmetry information found in %s.' % args.symmetry[1]) sys_results = {'charges': results['charges']} sym_results = symmetry_analysis(sys, sym, sys_results) results['symmetry'] = sym_results sys.extra['symmetry'] = sym # Store the results in an HDF5 file write_script_output(fn_h5, grp_name, results, args)
def main(): args = parse_args() fn_h5, grp_name = parse_h5(args.output, 'output') # check if the group is already present (and not empty) in the output file if check_output(fn_h5, grp_name, args.overwrite): return # Load the cost function from the HDF5 file cost, used_volume = load_cost(args.cost) # Load the charges from the HDF5 file charges = load_charges(args.charges) # Fix total charge if requested if args.qtot is not None: charges -= (charges.sum() - args.qtot) / len(charges) # Store parameters in output results = {} results['qtot'] = charges.sum() # Fitness of the charges results['cost'] = cost.value_charges(charges) if results['cost'] < 0: results['rmsd'] = 0.0 else: results['rmsd'] = (results['cost'] / used_volume)**0.5 # Worst case stuff results['cost_worst'] = cost.worst(0.0) if results['cost_worst'] < 0: results['rmsd_worst'] = 0.0 else: results['rmsd_worst'] = (results['cost_worst'] / used_volume)**0.5 # Write some things on screen if log.do_medium: log('RMSD charges: %10.5e' % np.sqrt( (charges**2).mean())) log('RMSD ESP: %10.5e' % results['rmsd']) log('Worst RMSD ESP: %10.5e' % results['rmsd_worst']) log.hline() # Store the results in an HDF5 file write_script_output(fn_h5, grp_name, results, args)
def main(): args = parse_args() fn_h5, grp_name = parse_h5(args.output, 'output') # check if the group is already present (and not empty) in the output file if check_output(fn_h5, grp_name, args.overwrite): return # Load the cost function from the HDF5 file cost, used_volume = load_cost(args.cost) # Find the optimal charges results = {} # MODIFICATION HERE results['x'] = cost.solve(args.qtot, args.ridge) results['charges'] = results['x'][:cost.natom] # Related properties results['cost'] = cost.value(results['x']) if results['cost'] < 0: results['rmsd'] = 0.0 else: results['rmsd'] = (results['cost'] / used_volume)**0.5 # Worst case stuff results['cost_worst'] = cost.worst(0.0) if results['cost_worst'] < 0: results['rmsd_worst'] = 0.0 else: results['rmsd_worst'] = (results['cost_worst'] / used_volume)**0.5 # Write some things on screen if log.do_medium: log('Important parameters:') log.hline() log('RMSD charges: %10.5e' % np.sqrt( (results['charges']**2).mean())) log('RMSD ESP: %10.5e' % results['rmsd']) log('Worst RMSD ESP: %10.5e' % results['rmsd_worst']) log.hline() # Store the results in an HDF5 file write_script_output(fn_h5, grp_name, results, args)
def main(): args = parse_args() fn_h5, grp_name = parse_h5(args.output, 'output') # check if the group is already present (and not empty) in the output file if check_output(fn_h5, grp_name, args.overwrite): return # Load the cost function from the HDF5 file cost, used_volume = load_cost(args.cost) # Load the charges from the HDF5 file charges = load_charges(args.charges) # Fix total charge if requested if args.qtot is not None: charges -= (charges.sum() - args.qtot)/len(charges) # Store parameters in output results = {} results['qtot'] = charges.sum() # Fitness of the charges results['cost'] = cost.value_charges(charges) if results['cost'] < 0: results['rmsd'] = 0.0 else: results['rmsd'] = (results['cost']/used_volume)**0.5 # Worst case stuff results['cost_worst'] = cost.worst(0.0) if results['cost_worst'] < 0: results['rmsd_worst'] = 0.0 else: results['rmsd_worst'] = (results['cost_worst']/used_volume)**0.5 # Write some things on screen if log.do_medium: log('RMSD charges: %10.5e' % np.sqrt((charges**2).mean())) log('RMSD ESP: %10.5e' % results['rmsd']) log('Worst RMSD ESP: %10.5e' % results['rmsd_worst']) log.hline() # Store the results in an HDF5 file write_script_output(fn_h5, grp_name, results, args)
def main(): args = parse_args() fn_h5, grp_name = parse_h5(args.output, 'output') # check if the group is already present (and not empty) in the output file if check_output(fn_h5, grp_name, args.overwrite): return # Load the cost function from the HDF5 file cost, used_volume = load_cost(args.cost) # Find the optimal charges results = {} results['x'] = cost.solve(args.qtot, args.ridge) results['charges'] = results['x'][:cost.natom] # Related properties results['cost'] = cost.value(results['x']) if results['cost'] < 0: results['rmsd'] = 0.0 else: results['rmsd'] = (results['cost']/used_volume)**0.5 # Worst case stuff results['cost_worst'] = cost.worst(0.0) if results['cost_worst'] < 0: results['rmsd_worst'] = 0.0 else: results['rmsd_worst'] = (results['cost_worst']/used_volume)**0.5 # Write some things on screen if log.do_medium: log('Important parameters:') log.hline() log('RMSD charges: %10.5e' % np.sqrt((results['charges']**2).mean())) log('RMSD ESP: %10.5e' % results['rmsd']) log('Worst RMSD ESP: %10.5e' % results['rmsd_worst']) log.hline() # Store the results in an HDF5 file write_script_output(fn_h5, grp_name, results, args)