dpgen.auto_test package

Subpackages

Submodules

dpgen.auto_test.ABACUS module

class dpgen.auto_test.ABACUS.ABACUS(inter_parameter, path_to_poscar)[source]

Bases: Task

Methods

backward_files([property_type])

Return backward files.

compute(output_dir)

Compute output of the task.

forward_common_files([property_type])

Return forward common files.

forward_files([property_type])

Return forward files.

make_input_file(output_dir, task_type, ...)

Prepare input files for a computational task For example, the VASP prepares INCAR.

make_potential_files(output_dir)

Prepare potential files for a computational task.

modify_input

backward_files(property_type='relaxation')[source]

Return backward files.

compute(output_dir)[source]

Compute output of the task. IMPORTANT: The output configuration should be converted and stored in a CONTCAR file.

Parameters:
output_dirstr

The directory storing the input and output files.

Returns:
result_dict: dict

A dict that storing the result. For example: { “energy”: xxx, “force”: [xxx] }

Notes

The following files are generated: CONTCAR: output file

The output configuration is converted to CONTCAR and stored in the output_dir

forward_common_files(property_type='relaxation')[source]

Return forward common files.

forward_files(property_type='relaxation')[source]

Return forward files.

make_input_file(output_dir, task_type, task_param)[source]

Prepare input files for a computational task For example, the VASP prepares INCAR. LAMMPS (including DeePMD, MEAM…) prepares in.lammps.

Parameters:
output_dirstr

The directory storing the input files.

task_typestr

Can be - “relaxation:”: structure relaxation - “static”: static computation calculates the energy, force… of a strcture

task_paramdict

The parameters of the task. For example the VASP interaction can be provided with { “ediff”: 1e-6, “ediffg”: 1e-5 }

make_potential_files(output_dir)[source]

Prepare potential files for a computational task. For example, the VASP prepares POTCAR. DeePMD prepares frozen model(s). IMPORTANT: Interaction should be stored in output_dir/inter.json.

Parameters:
output_dirstr

The directory storing the potential files.

Notes

The following files are generated:

inter.json: output file

The task information is stored in output_dir/inter.json

modify_input(incar, x, y)[source]

dpgen.auto_test.EOS module

class dpgen.auto_test.EOS.EOS(parameter, inter_param=None)[source]

Bases: Property

Methods

compute(output_file, print_file, path_to_work)

Postprocess the finished tasks to compute the property.

make_confs(path_to_work, path_to_equi[, refine])

Make configurations needed to compute the property.

post_process(task_list)

post_process the KPOINTS file in elastic.

task_param()

Return the parameter of each computational task, for example, {'ediffg': 1e-4}.

task_type()

Return the type of each computational task, for example, 'relaxation', 'static'....

make_confs(path_to_work, path_to_equi, refine=False)[source]

Make configurations needed to compute the property. The tasks directory will be named as path_to_work/task.xxxxxx IMPORTANT: handel the case when the directory exists.

Parameters:
path_to_workstr

The path where the tasks for the property are located

path_to_equistr

-refine == False: The path to the directory that equilibrated the configuration. -refine == True: The path to the directory that has property confs.

refinestr

To refine existing property confs or generate property confs from a equilibrated conf

Returns:
task_list: list of str

The list of task directories.

post_process(task_list)[source]

post_process the KPOINTS file in elastic.

task_param()[source]

Return the parameter of each computational task, for example, {‘ediffg’: 1e-4}.

task_type()[source]

Return the type of each computational task, for example, ‘relaxation’, ‘static’….

dpgen.auto_test.Elastic module

class dpgen.auto_test.Elastic.Elastic(parameter, inter_param=None)[source]

Bases: Property

Methods

compute(output_file, print_file, path_to_work)

Postprocess the finished tasks to compute the property.

make_confs(path_to_work, path_to_equi[, refine])

Make configurations needed to compute the property.

post_process(task_list)

post_process the KPOINTS file in elastic.

task_param()

Return the parameter of each computational task, for example, {'ediffg': 1e-4}.

task_type()

Return the type of each computational task, for example, 'relaxation', 'static'....

make_confs(path_to_work, path_to_equi, refine=False)[source]

Make configurations needed to compute the property. The tasks directory will be named as path_to_work/task.xxxxxx IMPORTANT: handel the case when the directory exists.

Parameters:
path_to_workstr

The path where the tasks for the property are located

path_to_equistr

-refine == False: The path to the directory that equilibrated the configuration. -refine == True: The path to the directory that has property confs.

refinestr

To refine existing property confs or generate property confs from a equilibrated conf

Returns:
task_list: list of str

The list of task directories.

post_process(task_list)[source]

post_process the KPOINTS file in elastic.

task_param()[source]

Return the parameter of each computational task, for example, {‘ediffg’: 1e-4}.

task_type()[source]

Return the type of each computational task, for example, ‘relaxation’, ‘static’….

dpgen.auto_test.Gamma module

class dpgen.auto_test.Gamma.Gamma(parameter, inter_param=None)[source]

Bases: Property

Calculation of common gamma lines for bcc and fcc.

Methods

compute(output_file, print_file, path_to_work)

Postprocess the finished tasks to compute the property.

make_confs(path_to_work, path_to_equi[, refine])

Make configurations needed to compute the property.

post_process(task_list)

post_process the KPOINTS file in elastic.

task_param()

Return the parameter of each computational task, for example, {'ediffg': 1e-4}.

task_type()

Return the type of each computational task, for example, 'relaxation', 'static'....

centralize_slab

return_direction

static centralize_slab(slab) None[source]
make_confs(path_to_work, path_to_equi, refine=False)[source]

Make configurations needed to compute the property. The tasks directory will be named as path_to_work/task.xxxxxx IMPORTANT: handel the case when the directory exists.

Parameters:
path_to_workstr

The path where the tasks for the property are located

path_to_equistr

-refine == False: The path to the directory that equilibrated the configuration. -refine == True: The path to the directory that has property confs.

refinestr

To refine existing property confs or generate property confs from a equilibrated conf

Returns:
task_list: list of str

The list of task directories.

post_process(task_list)[source]

post_process the KPOINTS file in elastic.

return_direction()[source]
task_param()[source]

Return the parameter of each computational task, for example, {‘ediffg’: 1e-4}.

task_type()[source]

Return the type of each computational task, for example, ‘relaxation’, ‘static’….

dpgen.auto_test.Interstitial module

class dpgen.auto_test.Interstitial.Interstitial(parameter, inter_param=None)[source]

Bases: Property

Methods

compute(output_file, print_file, path_to_work)

Postprocess the finished tasks to compute the property.

make_confs(path_to_work, path_to_equi[, refine])

Make configurations needed to compute the property.

post_process(task_list)

post_process the KPOINTS file in elastic.

task_param()

Return the parameter of each computational task, for example, {'ediffg': 1e-4}.

task_type()

Return the type of each computational task, for example, 'relaxation', 'static'....

make_confs(path_to_work, path_to_equi, refine=False)[source]

Make configurations needed to compute the property. The tasks directory will be named as path_to_work/task.xxxxxx IMPORTANT: handel the case when the directory exists.

Parameters:
path_to_workstr

The path where the tasks for the property are located

path_to_equistr

-refine == False: The path to the directory that equilibrated the configuration. -refine == True: The path to the directory that has property confs.

refinestr

To refine existing property confs or generate property confs from a equilibrated conf

Returns:
task_list: list of str

The list of task directories.

post_process(task_list)[source]

post_process the KPOINTS file in elastic.

task_param()[source]

Return the parameter of each computational task, for example, {‘ediffg’: 1e-4}.

task_type()[source]

Return the type of each computational task, for example, ‘relaxation’, ‘static’….

dpgen.auto_test.Lammps module

class dpgen.auto_test.Lammps.Lammps(inter_parameter, path_to_poscar)[source]

Bases: Task

Methods

backward_files([property_type])

Return backward files.

compute(output_dir)

Compute output of the task.

forward_common_files([property_type])

Return forward common files.

forward_files([property_type])

Return forward files.

make_input_file(output_dir, task_type, ...)

Prepare input files for a computational task For example, the VASP prepares INCAR.

make_potential_files(output_dir)

Prepare potential files for a computational task.

set_inter_type_func

set_model_param

backward_files(property_type='relaxation')[source]

Return backward files.

compute(output_dir)[source]

Compute output of the task. IMPORTANT: The output configuration should be converted and stored in a CONTCAR file.

Parameters:
output_dirstr

The directory storing the input and output files.

Returns:
result_dict: dict

A dict that storing the result. For example: { “energy”: xxx, “force”: [xxx] }

Notes

The following files are generated: CONTCAR: output file

The output configuration is converted to CONTCAR and stored in the output_dir

forward_common_files(property_type='relaxation')[source]

Return forward common files.

forward_files(property_type='relaxation')[source]

Return forward files.

make_input_file(output_dir, task_type, task_param)[source]

Prepare input files for a computational task For example, the VASP prepares INCAR. LAMMPS (including DeePMD, MEAM…) prepares in.lammps.

Parameters:
output_dirstr

The directory storing the input files.

task_typestr

Can be - “relaxation:”: structure relaxation - “static”: static computation calculates the energy, force… of a strcture

task_paramdict

The parameters of the task. For example the VASP interaction can be provided with { “ediff”: 1e-6, “ediffg”: 1e-5 }

make_potential_files(output_dir)[source]

Prepare potential files for a computational task. For example, the VASP prepares POTCAR. DeePMD prepares frozen model(s). IMPORTANT: Interaction should be stored in output_dir/inter.json.

Parameters:
output_dirstr

The directory storing the potential files.

Notes

The following files are generated:

inter.json: output file

The task information is stored in output_dir/inter.json

set_inter_type_func()[source]
set_model_param()[source]

dpgen.auto_test.Property module

class dpgen.auto_test.Property.Property(parameter)[source]

Bases: ABC

Attributes:
task_param

Return the parameter of each computational task, for example, {‘ediffg’: 1e-4}.

task_type

Return the type of each computational task, for example, ‘relaxation’, ‘static’….

Methods

compute(output_file, print_file, path_to_work)

Postprocess the finished tasks to compute the property.

make_confs(path_to_work, path_to_equi[, refine])

Make configurations needed to compute the property.

post_process(task_list)

post_process the KPOINTS file in elastic.

compute(output_file, print_file, path_to_work)[source]

Postprocess the finished tasks to compute the property. Output the result to a json database.

Parameters:
output_file:

The file to output the property in json format

print_file:

The file to output the property in txt format

path_to_work:

The working directory where the computational tasks locate.

abstract make_confs(path_to_work, path_to_equi, refine=False)[source]

Make configurations needed to compute the property. The tasks directory will be named as path_to_work/task.xxxxxx IMPORTANT: handel the case when the directory exists.

Parameters:
path_to_workstr

The path where the tasks for the property are located

path_to_equistr

-refine == False: The path to the directory that equilibrated the configuration. -refine == True: The path to the directory that has property confs.

refinestr

To refine existing property confs or generate property confs from a equilibrated conf

Returns:
task_list: list of str

The list of task directories.

abstract post_process(task_list)[source]

post_process the KPOINTS file in elastic.

abstract property task_param

Return the parameter of each computational task, for example, {‘ediffg’: 1e-4}.

abstract property task_type

Return the type of each computational task, for example, ‘relaxation’, ‘static’….

dpgen.auto_test.Surface module

class dpgen.auto_test.Surface.Surface(parameter, inter_param=None)[source]

Bases: Property

Methods

compute(output_file, print_file, path_to_work)

Postprocess the finished tasks to compute the property.

make_confs(path_to_work, path_to_equi[, refine])

Make configurations needed to compute the property.

post_process(task_list)

post_process the KPOINTS file in elastic.

task_param()

Return the parameter of each computational task, for example, {'ediffg': 1e-4}.

task_type()

Return the type of each computational task, for example, 'relaxation', 'static'....

make_confs(path_to_work, path_to_equi, refine=False)[source]

Make configurations needed to compute the property. The tasks directory will be named as path_to_work/task.xxxxxx IMPORTANT: handel the case when the directory exists.

Parameters:
path_to_workstr

The path where the tasks for the property are located

path_to_equistr

-refine == False: The path to the directory that equilibrated the configuration. -refine == True: The path to the directory that has property confs.

refinestr

To refine existing property confs or generate property confs from a equilibrated conf

Returns:
task_list: list of str

The list of task directories.

post_process(task_list)[source]

post_process the KPOINTS file in elastic.

task_param()[source]

Return the parameter of each computational task, for example, {‘ediffg’: 1e-4}.

task_type()[source]

Return the type of each computational task, for example, ‘relaxation’, ‘static’….

dpgen.auto_test.Task module

class dpgen.auto_test.Task.Task(inter_parameter, path_to_poscar)[source]

Bases: ABC

Attributes:
backward_files

Return backward files.

forward_common_files

Return forward common files.

forward_files

Return forward files.

Methods

compute(output_dir)

Compute output of the task.

make_input_file(output_dir, task_type, ...)

Prepare input files for a computational task For example, the VASP prepares INCAR.

make_potential_files(output_dir)

Prepare potential files for a computational task.

abstract property backward_files

Return backward files.

abstract compute(output_dir)[source]

Compute output of the task. IMPORTANT: The output configuration should be converted and stored in a CONTCAR file.

Parameters:
output_dirstr

The directory storing the input and output files.

Returns:
result_dict: dict

A dict that storing the result. For example: { “energy”: xxx, “force”: [xxx] }

Notes

The following files are generated: CONTCAR: output file

The output configuration is converted to CONTCAR and stored in the output_dir

abstract property forward_common_files

Return forward common files.

abstract property forward_files

Return forward files.

abstract make_input_file(output_dir, task_type, task_param)[source]

Prepare input files for a computational task For example, the VASP prepares INCAR. LAMMPS (including DeePMD, MEAM…) prepares in.lammps.

Parameters:
output_dirstr

The directory storing the input files.

task_typestr

Can be - “relaxation:”: structure relaxation - “static”: static computation calculates the energy, force… of a strcture

task_paramdict

The parameters of the task. For example the VASP interaction can be provided with { “ediff”: 1e-6, “ediffg”: 1e-5 }

abstract make_potential_files(output_dir)[source]

Prepare potential files for a computational task. For example, the VASP prepares POTCAR. DeePMD prepares frozen model(s). IMPORTANT: Interaction should be stored in output_dir/inter.json.

Parameters:
output_dirstr

The directory storing the potential files.

Notes

The following files are generated:

inter.json: output file

The task information is stored in output_dir/inter.json

dpgen.auto_test.VASP module

class dpgen.auto_test.VASP.VASP(inter_parameter, path_to_poscar)[source]

Bases: Task

Methods

backward_files([property_type])

Return backward files.

compute(output_dir)

Compute output of the task.

forward_common_files([property_type])

Return forward common files.

forward_files([property_type])

Return forward files.

make_input_file(output_dir, task_type, ...)

Prepare input files for a computational task For example, the VASP prepares INCAR.

make_potential_files(output_dir)

Prepare potential files for a computational task.

backward_files(property_type='relaxation')[source]

Return backward files.

compute(output_dir)[source]

Compute output of the task. IMPORTANT: The output configuration should be converted and stored in a CONTCAR file.

Parameters:
output_dirstr

The directory storing the input and output files.

Returns:
result_dict: dict

A dict that storing the result. For example: { “energy”: xxx, “force”: [xxx] }

Notes

The following files are generated: CONTCAR: output file

The output configuration is converted to CONTCAR and stored in the output_dir

forward_common_files(property_type='relaxation')[source]

Return forward common files.

forward_files(property_type='relaxation')[source]

Return forward files.

make_input_file(output_dir, task_type, task_param)[source]

Prepare input files for a computational task For example, the VASP prepares INCAR. LAMMPS (including DeePMD, MEAM…) prepares in.lammps.

Parameters:
output_dirstr

The directory storing the input files.

task_typestr

Can be - “relaxation:”: structure relaxation - “static”: static computation calculates the energy, force… of a strcture

task_paramdict

The parameters of the task. For example the VASP interaction can be provided with { “ediff”: 1e-6, “ediffg”: 1e-5 }

make_potential_files(output_dir)[source]

Prepare potential files for a computational task. For example, the VASP prepares POTCAR. DeePMD prepares frozen model(s). IMPORTANT: Interaction should be stored in output_dir/inter.json.

Parameters:
output_dirstr

The directory storing the potential files.

Notes

The following files are generated:

inter.json: output file

The task information is stored in output_dir/inter.json

dpgen.auto_test.Vacancy module

class dpgen.auto_test.Vacancy.Vacancy(parameter, inter_param=None)[source]

Bases: Property

Methods

compute(output_file, print_file, path_to_work)

Postprocess the finished tasks to compute the property.

make_confs(path_to_work, path_to_equi[, refine])

Make configurations needed to compute the property.

post_process(task_list)

post_process the KPOINTS file in elastic.

task_param()

Return the parameter of each computational task, for example, {'ediffg': 1e-4}.

task_type()

Return the type of each computational task, for example, 'relaxation', 'static'....

make_confs(path_to_work, path_to_equi, refine=False)[source]

Make configurations needed to compute the property. The tasks directory will be named as path_to_work/task.xxxxxx IMPORTANT: handel the case when the directory exists.

Parameters:
path_to_workstr

The path where the tasks for the property are located

path_to_equistr

-refine == False: The path to the directory that equilibrated the configuration. -refine == True: The path to the directory that has property confs.

refinestr

To refine existing property confs or generate property confs from a equilibrated conf

Returns:
task_list: list of str

The list of task directories.

post_process(task_list)[source]

post_process the KPOINTS file in elastic.

task_param()[source]

Return the parameter of each computational task, for example, {‘ediffg’: 1e-4}.

task_type()[source]

Return the type of each computational task, for example, ‘relaxation’, ‘static’….

dpgen.auto_test.calculator module

dpgen.auto_test.calculator.make_calculator(inter_parameter, path_to_poscar)[source]

Make an instance of Task.

dpgen.auto_test.common_equi module

dpgen.auto_test.common_equi.make_equi(confs, inter_param, relax_param)[source]
dpgen.auto_test.common_equi.post_equi(confs, inter_param)[source]
dpgen.auto_test.common_equi.run_equi(confs, inter_param, mdata)[source]

dpgen.auto_test.common_prop module

dpgen.auto_test.common_prop.make_property(confs, inter_param, property_list)[source]
dpgen.auto_test.common_prop.make_property_instance(parameters, inter_param)[source]

Make an instance of Property.

dpgen.auto_test.common_prop.post_property(confs, inter_param, property_list)[source]
dpgen.auto_test.common_prop.run_property(confs, inter_param, property_list, mdata)[source]
dpgen.auto_test.common_prop.worker(work_path, all_task, forward_common_files, forward_files, backward_files, mdata, inter_type)[source]

dpgen.auto_test.gen_confs module

dpgen.auto_test.gen_confs.gen_alloy(eles, key)[source]
dpgen.auto_test.gen_confs.gen_ele_std(ele_name, ctype)[source]
dpgen.auto_test.gen_confs.gen_element(ele_name, key)[source]
dpgen.auto_test.gen_confs.gen_element_std(ele_name)[source]
dpgen.auto_test.gen_confs.make_path_mp(ii)[source]
dpgen.auto_test.gen_confs.test_fit(struct, data)[source]

dpgen.auto_test.mpdb module

dpgen.auto_test.mpdb.check_apikey()[source]
dpgen.auto_test.mpdb.get_structure(mp_id)[source]

dpgen.auto_test.refine module

dpgen.auto_test.refine.make_refine(init_from_suffix, output_suffix, path_to_work)[source]

dpgen.auto_test.reproduce module

dpgen.auto_test.reproduce.make_repro(inter_param, init_data_path, init_from_suffix, path_to_work, reprod_last_frame=True)[source]
dpgen.auto_test.reproduce.post_repro(init_data_path, init_from_suffix, all_tasks, ptr_data, reprod_last_frame=True)[source]

dpgen.auto_test.run module

dpgen.auto_test.run.gen_test(args)[source]
dpgen.auto_test.run.run_task(step, param_file, machine_file=None)[source]