cgexplore.forcefields.ForceField

class cgexplore.forcefields.ForceField(identifier, prefix, present_beads, bond_targets, angle_targets, torsion_targets, nonbonded_targets, vdw_bond_cutoff, verbose=True)[source]

Bases: object

Define a CG ForceField.

Parameters:
  • identifier (str) – String idenifier of the forcefield.

  • prefix (str) – Prefix for the forcefield for file saving.

  • present_beads (Sequence[CgBead]) – The CgBeads that are present in the model.

  • bond_targets (Sequence[TargetBond | TargetMartiniBond]) – Target bond classes to find and assign. See systems_optimisation.utilities for an example.

  • angle_targets (Sequence[TargetAngle | TargetCosineAngle | TargetMartiniAngle]) – Target angle classes to find and assign. See systems_optimisation.utilities for an example.

  • torsion_targets (Sequence[TargetTorsion | TargetMartiniTorsion]) – Target torsion classes to find and assign. See systems_optimisation.utilities for an example.

  • nonbonded_targets (Sequence[TargetNonbonded]) – Target nonbonded term classes to find and assign. See systems_optimisation.utilities for an example.

  • vdw_bond_cutoff (int) – How many bonds between excluded beads from nonbonded terms.

  • verbose (bool) – True if cgexplore should inform the user about what it assigns.

Methods

assign_terms

Assign forcefield terms to molecule.

get_all_possible_terms

Check if there are missing terms in forcefield.

get_bead_library

Get beads in forcefield.

get_forcefield_dictionary

Get the underlying forcefield dict.

get_hr_file_name

Get human-readable file name.

get_identifier

Get forcefield identifier.

get_prefix

Get forcefield prefix.

get_present_beads

Get beads present.

get_targets

Get targets of forcefield.

get_vdw_bond_cutoff

Get vdW bond cutoff of forcefield.

write_human_readable

Write forcefield definition to human-readable file.

assign_terms(molecule, name, output_dir)[source]

Assign forcefield terms to molecule.

Parameters:
  • molecule (Molecule)

  • name (str)

  • output_dir (Path)

Return type:

AssignedSystem

get_all_possible_terms(molecule)[source]

Check if there are missing terms in forcefield.

Parameters:

molecule (Molecule)

Return type:

None

get_bead_library()[source]

Get beads in forcefield.

Return type:

BeadLibrary

get_forcefield_dictionary()[source]

Get the underlying forcefield dict.

Return type:

dict[str, str | dict]

get_hr_file_name()[source]

Get human-readable file name.

Return type:

str

get_identifier()[source]

Get forcefield identifier.

Return type:

str

get_prefix()[source]

Get forcefield prefix.

Return type:

str

get_present_beads()[source]

Get beads present.

Return type:

Sequence[CgBead]

get_targets()[source]

Get targets of forcefield.

Return type:

dict

get_vdw_bond_cutoff()[source]

Get vdW bond cutoff of forcefield.

Return type:

int

write_human_readable(output_dir)[source]

Write forcefield definition to human-readable file.

Parameters:

output_dir (Path)

Return type:

None