allfunc module

grouped_basisの作成は、複雑なのは自作してもらうかto be continued, 金属種ごとくらいなら実装する?金属間化合物や酸化物で重要になるが、今の間はしない。後ほど行う。 サイトの違いはgrouped_basisで対応できる ひとまずCu-Coに速く映りたい Cu111から 七種君にもやることを確認。急いで毎日やる logger infoとdebugを書いていく 最後のチェックがてら。読みにくいところは修正の余地ありなのでそのチェックにも

allfunc.check_type(Object, Type)[ソース]
class allfunc.Prepare_Config(config_path=None)[ソース]

ベースクラス: object

__init__(config_path=None)[ソース]
read()[ソース]
save(save_path)[ソース]
write(section, key, value)[ソース]
allfunc.storage_path_initialize(config)[ソース]
input:

config: Prepare_Configクラスのもの。

description:

storage_pathを設定し、hostの構造と使用するconfigを保存する(ある意味、その時々の状況のセーブになっている)

allfunc.output_symmetry(config, storage_path=None, host=None)[ソース]
input:

config: Prepare_Configクラスのもの。 storage_path: configで自動設定されるが、別用途で使いたいときのため host: 同上, 設定の時はase.Atoms class

output:

rotations: 回転対称操作 translations: 並進対称操作

description:

host.cifの対称性を確認するとともに対称操作を返す

allfunc.convert_nanosheet_into_slab(config, host=None)[ソース]
input:

config: Prepare_Configクラスのもの。 host: configで自動設定されるが、別用途で使いたいときのため。設定の時はase.Atoms class

output:

None

description:

ナノシートモデル(上下とも緩和)をスラブモデル(固定層を設定)に変換。output_symmetryに入れる前に行うことでスラブモデルの場合はz方向に少し原子を動かすことでz方向の対称性をなくす。

allfunc.symmetry_equivalent_arrange(host, symmetry)[ソース]
input:

host: 対称性を明らかにしたい構造。 symmetry: spglib.get_symmetry_datasetの結果か、dict:{"rotations": output_symmetry(config)[0],"translations": output_symmetry(config)[1]}でOK

output:

symmtetry_equivalent_arrange_index: 並進回転対象運動後の原子位置の移動先

description:

host.cifの対称性を確認するとともに対称操作を返す

allfunc.visualize_symmetry_operation(config)[ソース]
input:

config: Prepare_Configクラスのもの。

output:

None

description:

visualizeフォルダにsymmetry_operationフォルダを作り、対称操作の結果を記したcifファイルを保存する

allfunc.bulk2slab(conventional_cell, miller, size, vacuum_thickness)[ソース]
allfunc.adjust_concentration_each_layer(prim, basis_elements, grouped_basis, ranges)[ソース]
class allfunc.SurfaceAtomsManager(atoms)[ソース]

ベースクラス: AtomsManager

__init__(atoms)[ソース]
index_by_basis(grouped_basis)[ソース]
basisindex_by_tag(tag2grouped_basis)[ソース]
class allfunc.ClusterExpansionSettings_nowarning(prim, concentration, size, supercell_factor=27, db_name='clease.db', max_cluster_dia=(5.0, 5.0, 5.0), include_background_atoms=False, basis_func_type='polynomial')[ソース]

ベースクラス: ClusterExpansionSettings

__init__(prim, concentration, size, supercell_factor=27, db_name='clease.db', max_cluster_dia=(5.0, 5.0, 5.0), include_background_atoms=False, basis_func_type='polynomial')[ソース]
tag2grouped_basis(prim_cell, grouped_basis)[ソース]
property index_by_basis
property all_cf_names
property cluster_mng
create_cluster_list_and_trans_matrix()[ソース]

Prepares the internal cache objects by calculating cluster related properties

allfunc.cluster2index(config, prim, clusters, target_structure)[ソース]
allfunc.cf_calculator_each_sublattice(config, atoms, settings, cf_dict, cluster_list)[ソース]
allfunc.validate_calculatedCF(cluster_expansion_excutor)[ソース]
class allfunc.ClusterManager_each_sublattice(prim_cell, background_syms=None)[ソース]

ベースクラス: ClusterManager

__init__(prim_cell, background_syms=None)[ソース]
build(max_cluster_dia)[ソース]

Construct all clusters.

Parameters:

max_cluster_dia: sequence of floats

Maximum distance between two atoms in a cluster, for each cluster body. The diameters start at 2-body clusters

cluster_list_for_template(template)[ソース]

Specialise the cluster information to a template. Returns a new ClusterList instance.

Parameter:

template: ase.Atoms

Atoms object representing the simulation cell

allfunc.CESlab_nowarning(conventional_cell, miller, basis_elements, ranges, grouped_basis, vacuum_thickness, model_type, size, **kwargs)[ソース]
パラメータ:
  • conventional_cell -- Bulk lattice structure. Note that the unit-cell must be the conventional cell - not the primitive cell. One can also give the chemical symbol as a string, in which case the correct bulk lattice will be generated automatically.

  • miller -- Surface normal in Miller indices (h,k,l).

  • concentration -- Class for restricting the concentrations

  • size -- Size of the simulations cell. The third number represents the number of layers. The two first are repetitions of the in-plane unit vectors

For more kwargs, see docstring of clease.settings.ClusterExpansionSettings.

class allfunc.Calculator(config)[ソース]

ベースクラス: object

__init__(config)[ソース]
optimization(model, model_id, constraint_dict=None)[ソース]
single_point(model, model_id, constraint_dict=None)[ソース]
csv_write(model, model_id, energy, constraint_dict=None)[ソース]
csv_read(data)[ソース]
csv_write_formationE()[ソース]
class allfunc.CSV_Reader(config, **kwargs)[ソース]

ベースクラス: Calculator

implemented_properties: List[str] = ['energy']

Properties calculator can handle (energy, forces, ...)

nolabel = True
default_parameters: Dict[str, Any] = {'asap_cutoff': False}

Default parameters

__init__(config, **kwargs)[ソース]

Basic calculator implementation.

restart: str

Prefix for restart file. May contain a directory. Default is None: don't restart.

ignore_bad_restart_file: bool

Deprecated, please do not use. Passing more than one positional argument to Calculator() is deprecated and will stop working in the future. Ignore broken or missing restart file. By default, it is an error if the restart file is missing or broken.

directory: str or PurePath

Working directory in which to read and write files and perform calculations.

label: str

Name used for all files. Not supported by all calculators. May contain a directory, but please use the directory parameter for that instead.

atoms: Atoms object

Optional Atoms object to which the calculator will be attached. When restarting, atoms will get its positions and unit-cell updated from file.

calculate(atoms=None, properties=['energy'], system_changes=['positions', 'numbers', 'cell', 'pbc', 'initial_charges', 'initial_magmoms'])[ソース]

Do the calculation.

properties: list of str

List of what needs to be calculated. Can be any combination of 'energy', 'forces', 'stress', 'dipole', 'charges', 'magmom' and 'magmoms'.

system_changes: list of str

List of what has changed since last calculation. Can be any combination of these six: 'positions', 'numbers', 'cell', 'pbc', 'initial_charges' and 'initial_magmoms'.

Subclasses need to implement this, but can ignore properties and system_changes if they want. Calculated properties should be inserted into results dictionary like shown in this dummy example:

self.results = {'energy': 0.0,
                'forces': np.zeros((len(atoms), 3)),
                'stress': np.zeros(6),
                'dipole': np.zeros(3),
                'charges': np.zeros(len(atoms)),
                'magmom': 0.0,
                'magmoms': np.zeros(len(atoms))}

The subclass implementation should first call this implementation to set the atoms attribute and create any missing directories.

get_potential_energy(atoms)[ソース]
set_model_id(model_id)[ソース]
class allfunc.NewStructures_each_sublattice(config, settings, generation_number=None, struct_per_gen=5, check_db=True)[ソース]

ベースクラス: NewStructures

__init__(config, settings, generation_number=None, struct_per_gen=5, check_db=True)[ソース]
generate_probe_structure(atoms=None, init_temp=None, final_temp=None, num_temp=5, num_steps_per_temp=1000, approx_mean_var=True, num_samples_var=10000)[ソース]

Generate a probe structure according to PRB 80, 165122 (2009).

パラメータ:
  • atoms -- ASE Atoms object with the desired cell size and shape of the new structure.

  • init_temp -- initial temperature (does not represent physical temperature)

  • final_temp -- final temperature (does not represent physical temperature)

  • num_temp -- number of temperatures to be used in simulated annealing

  • num_steps_per_temp -- number of steps in simulated annealing

  • approx_mean_var --

    whether or not to use a spherical and isotropical distribution approximation scheme for determining the mean variance.

    -True: Assume a spherical and isotropical distribution of

    structures in the configurational space. Corresponds to eq.4 in PRB 80, 165122 (2009)

    -False: Use sigma and mu of eq.3 in PRB 80, 165122 (2009)

    to characterize the distribution of structures in population. Requires pre-sampling of random structures before generating probe structures. sigma and mu are generated and stored in 'probe_structure-sigma_mu.npz' file.

  • num_samples_var -- number of samples to be used in determining signam and mu. Only used when approx_mean_var is True.

Note: init_temp and final_temp are automatically generated if either

one of the two is not specified.

class allfunc.ProbeStructure_each_sublattice(config, settings, atoms, init_temp=None, final_temp=None, num_temp=5, num_steps_per_temp=1000, approx_mean_var=False)[ソース]

ベースクラス: ProbeStructure

__init__(config, settings, atoms, init_temp=None, final_temp=None, num_temp=5, num_steps_per_temp=1000, approx_mean_var=False)[ソース]
class allfunc.CorrFunction_each_sublattice(config, settings)[ソース]

ベースクラス: CorrFunction

__init__(config, settings)[ソース]
get_cf_by_names(atoms, cf_names)[ソース]

Calculate correlation functions of the specified clusters and return them in a dictionary format.

パラメータ:
  • atoms -- Atoms object

  • cf_names -- list names of correlation functions that will be calculated for the structure provided in atoms

allfunc.check_position_overlap(new, reference, tol=0.1)[ソース]
allfunc.check_max_cluster_size(prim_model, size, max_cluster_size)[ソース]
class allfunc.Slab_Processor(cif_list=None, model_type=None, vacuum=None, config=None, leyer_number=None)[ソース]

ベースクラス: object

__init__(cif_list=None, model_type=None, vacuum=None, config=None, leyer_number=None)[ソース]
update_radiusdict(symbol, radius)[ソース]
selective_dynamics(POSCAR_list, adsorbate_number, fix_relax_list)[ソース]
set_cif_list(cif_list)[ソース]
set_vaccum_thickness(vacuum_thickness)[ソース]
set_leyer_number(leyer_number)[ソース]
set_model_type(model_type)[ソース]
load()[ソース]
save_cif(profix=None)[ソース]
save4visualize(profix=None)[ソース]
save_vasp(profix=None)[ソース]
process_iter(function)[ソース]
sort(model)[ソース]
remove_vacuum(model)[ソース]
add_vacuum(model)[ソース]
undo_z_wrap(model)[ソース]
adsorption_Hydrogen(model)[ソース]
adsorption_Oxygen(model)[ソース]
adsorption_Carbon(model)[ソース]
adsorption_CO(model)[ソース]
adsorption_moledule(model, adsorbate_data)[ソース]
search_surfaceatoms(model)[ソース]
model_expansion(model)[ソース]
get_surfaceatoms(model, connectivity)[ソース]
class allfunc.ClusterExpansionExcutor(config, seed=None, confirm_max_cluster_size=True)[ソース]

ベースクラス: object

__init__(config, seed=None, confirm_max_cluster_size=True)[ソース]
input:

config: Prepare_Configクラスのもの。 seed: 構造生成をそろえて比較したいとき用

output:

None

description:

CEの準備をします。

reload_config(config, cf=None)[ソース]
model_addition_random(generation_number=None)[ソース]
add_user_structure(model, cf=None)[ソース]
add_further_model(struct_per_gen=1, generation_number=None, mode=None, init_temp=2000, final_temp=1, num_temp=10, num_steps_per_temp=5000, random_composition=True, ECI_file_name='ECI.json')[ソース]
add_user_structure_origin(model)[ソース]
unconverged_calculate(constraint_dict=None)[ソース]
update_formation_energy()[ソース]
calculate(data, constraint_dict=None)[ソース]
ECI_evaluate(ECI_file_name='ECI.json', CV_filename=None)[ソース]
ECI_evaluate_with_cf_optimization(max_cf_num, ECI_file_name='ECI.json', CV_filename=None, init_sample=5, sample=15)[ソース]
additional_cf_optimization(ECI_file_name, CV_filename, sample)[ソース]
get_ECI(ECI_file_name='ECI.json')[ソース]
get_basis_function(unique_element)[ソース]
make_qubit(model=None)[ソース]
make_QUBO(qubit_dict=None, model=None, ECI_file_name=None)[ソース]
allfunc.plot_fit(evaluator)[ソース]
allfunc.plot_ECIs(evaluator)[ソース]
allfunc.plot_QUBO(data_paths, qubit_dict, QUBO, constant, csv_path)[ソース]
class allfunc.Annealing_Machine_Converter(config, QUBO, constant, qubit_dict)[ソース]

ベースクラス: object

__init__(config, QUBO, constant, qubit_dict)[ソース]
set_default_penalty(reference, method='cost_max')[ソース]
bit2energy(QUBO, constant, bits)[ソース]
endcode_to_annealing_machine()[ソース]
setting_constraints()[ソース]
run(substitute_number=None, penalty_multipliers=None)[ソース]
decode_to_universal_style(results)[ソース]
class allfunc.Fixstars_Amplify(config, QUBO, constant, qubit_dict)[ソース]

ベースクラス: Annealing_Machine_Converter

__init__(config, QUBO, constant, qubit_dict)[ソース]
encode_to_annealing_machine()[ソース]
setting_constraints(substitute_dict)[ソース]
run(penalty_multipliers=None, substitute_dict=None)[ソース]
decode_to_universal_style(results)[ソース]
allfunc.best_bits2model(result_dict, ClusterExpansionExcutor)[ソース]