sc::Molecule(3)
π sc::Molecule(3) β the MPQC manual page π
okay bestie, buckle up β this is the sc::Molecule page from MPQC, and itβs a whole main-character moment. itβs long, so this is part 1 of 2. no sign-off yet, weβre just getting started β¨
πΈ NAME πΈ
sc::Molecule β the Molecule class contains information about molecules. literally what it says on the tin, no cap π
π¦ SYNOPSIS π¦
#include <molecule.h>
Inherits sc::SavableState.
β¨ Public Member Functions β¨
Molecule (const Molecule &)β signature only, bestie; the original doesnβt give it a description.Molecule (StateIn &)β same deal, signature only.Molecule (const Ref< KeyVal > &input)β the Molecule KeyVal constructor is used to generate a Molecule object from the input. keyval girlies rise π«ΆMolecule & operator= (const Molecule &)β assignment operator, signature only.void add_atom (int Z, double x, double y, double z, const char *=0, double mass=0.0, int have_charge=0, double charge=0.0)β add an AtomicCenter to the Molecule. new atom just dropped πvirtual void print (std::ostream &=ExEnv::out0()) constβ print information about the molecule. show and tell time β¨virtual void print_parsedkeyval (std::ostream &=ExEnv::out0(), int print_pg=1, int print_unit=1, int number_atoms=1) constβ signature only, no description in the original.int natom () constβ returns the number of atoms in the molecule.int Z (int atom) constβ signature only.double & r (int atom, int xyz)β signature only.const double & r (int atom, int xyz) constβ signature only.double * r (int atom)β signature only.const double * r (int atom) constβ signature only.double mass (int atom) constβ signature only.const char * label (int atom) constβ returns the label explicitly assigned to atom.int atom_at_position (double *, double tol=0.05) constβ takes an (x, y, z) position and finds an atom within the given tolerance distance. detective mode πint atom_label_to_index (const char *label) constβ returns the index of the atom with the given label.double * charges () constβ returns adouble*containing the nuclear charges of the atoms.double charge (int iatom) constβ return the charge of the atom.double nuclear_charge () constβ returns the total nuclear charge.void set_point_group (const Ref< PointGroup > &, double tol=1.0e-7)β sets the PointGroup of the molecule. symmetry slay π«Ref< PointGroup > point_group () constβ returns the PointGroup of the molecule.Ref< PointGroup > highest_point_group (double tol=1.0e-8) constβ find this moleculeβs true point group (limited to abelian groups). itβs giving group theory realness πint is_axis (SCVector3 &origin, SCVector3 &udirection, int order, double tol=1.0e-8) constβ return 1 if this given axis is a symmetry element for the molecule.int is_plane (SCVector3 &origin, SCVector3 &uperp, double tol=1.0e-8) constβ return 1 if the given plane is a symmetry element for the molecule.int has_inversion (SCVector3 &origin, double tol=1.0e-8) constβ return 1 if the molecule has an inversion center.int is_linear (double tolerance=1.0e-5) constβ returns 1 if the molecule is linear, 0 otherwise.int is_planar (double tolerance=1.0e-5) constβ returns 1 if the molecule is planar, 0 otherwise.void is_linear_planar (int &linear, int &planar, double tol=1.0e-5) constβ setslinearto 1 if the molecule is linear, 0 otherwise.SCVector3 center_of_mass () constβ returns aSCVector3containing the cartesian coordinates of the center of mass for the molecule.double nuclear_repulsion_energy ()β returns the nuclear repulsion energy for the molecule.void nuclear_repulsion_1der (int center, double xyz[3])β compute the nuclear repulsion energy first derivative with respect to the given center.void nuclear_efield (const double *position, double *efield)β compute the electric field due to the nuclei at the given point.void nuclear_charge_efield (const double *charges, const double *position, double *efield)β compute the electric field due to the given charges at the positions of the nuclei at the given point.void symmetrize (double tol=0.5)β if the molecule contains only symmetry unique atoms, this function will generate the other, redundant atoms. fill in the blanks, bestie β¨void symmetrize (const Ref< PointGroup > &pg, double tol=0.5)β set the point group and then symmetrize.void cleanup_molecule (double tol=0.1)β this will try to carefully correct symmetry errors in molecules. gentle cleanup energy π§Ήvoid translate (const double *r)β signature only.void move_to_com ()β signature only.void transform_to_principal_axes (int trans_frame=1)β signature only.void transform_to_symmetry_frame ()β signature only.void print_pdb (std::ostream &=ExEnv::out0(), char *title=0) constβ signature only.void read_pdb (const char *filename)β signature only.void principal_moments_of_inertia (double *evals, double **evecs=0) constβ compute the principal moments of inertia and, possibly, the principal axes.int nunique () constβ return information about symmetry unique and equivalent atoms.int unique (int iuniq) constβ returns the overall number of theiuniqβth unique atom.int nequivalent (int iuniq) constβ returns the number of atoms equivalent toiuniq.int equivalent (int iuniq, int j) constβ returns thejβth atom equivalent toiuniq.int atom_to_unique (int iatom) constβ converts an atom number to the number of its generating unique atom.int atom_to_unique_offset (int iatom) constβ converts an atom number to the offset of this atom in the list of generated atoms.int n_core_electrons ()β return the number of core electrons.int max_z ()β return the maximum atomic number.Ref< AtomInfo > atominfo () constβ return the moleculeβsAtomInfoobject.std::string atom_name (int iatom) constβ returns the element name of the atom.std::string atom_symbol (int iatom) constβ returns the element symbol of the atom.void set_include_q (bool iq)β ifinclude_qis true, then include the'Q'atoms in the charge and efield routines.bool include_q () constβ returnsinclude_q. seeset_include_q.void set_include_qq (bool iqq)β ifinclude_qqis true, include the coupling between pairs of'Q'atoms when computing nuclear repulsion energy and gradients.bool include_qq () constβ returnsinclude_qq. seeset_include_qq.int n_q_atom () constβ retrieve the number of'Q'atoms.int q_atom (int i) constβ retrieve the'Q'atoms.int n_non_q_atom () constβ retrieve the number of non-'Q'atoms.int non_q_atom (int i) constβ retrieve the of non-'Q'atoms. (yes, thatβs the wording, donβt come for me π)void save_data_state (StateOut &)β save the base classes (withsave_data_state) and the members in the same order that theStateInCTOR initializes them.
π Protected Member Functions π
void init_symmetry_info (double tol=0.5)β signature only.void clear_symmetry_info ()β signature only.void clear ()β signature only.void throw_if_atom_duplicated (int begin=0, double tol=1e-3)β signature only.
π Protected Attributes π
int natoms_Ref< AtomInfo > atominfo_Ref< PointGroup > pg_Ref< Units > geometry_units_double ** r_int * Z_double * charges_int nuniq_int * nequiv_int ** equiv_int * atom_to_uniq_double * mass_char ** labels_int q_Z_bool include_q_bool include_qq_std::vector< int > q_atoms_std::vector< int > non_q_atoms_
β Additional Inherited Members β
there are more inherited members, bestie β theyβre inherited, so they live their truth elsewhere π
π₯ Detailed Description π₯
the Molecule class contains information about molecules. iconic, honestly.
it has a KeyVal constructor that can create a new molecule from either a PDB file or from a list of Cartesian coordinates.
the following ParsedKeyVal input reads from the PDB file h2o.pdb:
molecule<Molecule>: (
pdb_file = 'h2o.pdb'
)
the following input explicitly gives the atom coordinates, using the ParsedKeyVal table notation:
molecule<Molecule>: (
unit=angstrom
{ atom_labels atoms geometry } = {
O1 O [ 0.000000000 0 0.369372944 ]
H1 H [ 0.783975899 0 -0.184686472 ]
H2 H [-0.783975899 0 -0.184686472 ]
}
)
)
the default units are Bohr, which can be overridden with unit=angstrom. the atom_labels array can be omitted. the atoms and geometry arrays are required. required besties only β¨
as a special case, an atom can be given with the symbol Q or the name charge. such centers are treated as point charges and not given basis functions. the values of the charges must be specified with a charge vector in the Molecule input. since the charge vector assigns charges to all centers, including atoms, it is easiest to place all point charge centers first in the geometry, and then give a charge vector with a number of elements equal to the number of point charges. the following example shows a water molecule interacting with a point charge having value 0.1:
molecule<Molecule>: (
unit=angstrom
charge = [ 0.1 ]
{ atom_labels atoms geometry } = {
Q1 Q [ 0.0 0 10.0 ]
O1 O [ 0.000000000 0 0.369372944 ]
H1 H [ 0.783975899 0 -0.184686472 ]
H2 H [-0.783975899 0 -0.184686472 ]
}
)
)
this feature is designed for doing QM/MM calculations, so, by default, methods will not include interactions between the Q centers when computing the energy or the gradient. to include these interactions, set include_qq=1. periodt.
the Molecule class has a PointGroup member object, which also has a KeyVal constructor that is called when a Molecule is made. the following example constructs a molecule with $C_{2v}$ symmetry:
molecule<Molecule>: (
symmetry=c2v
unit=angstrom
{ atoms geometry } = {
O [0.000000000 0 0.369372944 ]
H [0.783975899 0 -0.184686472 ]
}
)
)
only the symmetry unique atoms need to be specified. nonunique atoms can be given too, however, numerical errors in the geometry specification can result in the generation of extra atoms, so be careful. like, actually be careful β extra atoms are not the vibe π
part 2 is coming, bestie β donβt touch that dial π
π Constructor & Destructor Documentation π
β¨ sc::Molecule::Molecule (const Ref< KeyVal > & input)
sc::Molecule::Molecule (const Ref< KeyVal > & input)
okay so bestie, the Molecule KeyVal constructor is what you use to generate a Molecule object from the input π
Several examples are given in the Molecule class overview. The full list of keywords that are accepted is below β no cap, this is the whole roster.
Keyword Β· Type Β· Default Β· Description
include_qβ boolean, defaultfalseβ some of the atoms can be specified asQand given a customizable charge. Such atoms are a point charge that do not have basis functions. If this option istrue, then theQatoms are included when computing the nuclear charge and the electric field due to the nuclear charge. β‘include_qqβ boolean, defaultfalseβ some of the atoms can be specified asQand given a customizable charge. Such atoms are a point charge that do not have basis functions. If this option istrue, then theQatoms are included when computing the nuclear repulsion energy and its derivatives. π₯atominfoβAtomInfo, defaultlibrary valuesβ this gives information about each atom, such as the symbol, name, and various atomic radii. π§symmetryβ string, defaultC1β the Schoenflies symbol of the point group. This is case insensitive. It should be a subgroup ofD2h. If it isauto, then the appropriate subgroup ofD2hwill be found. πsymmetry_toleranceβ double, default1.0e-4β when a molecule has symmetry, some atoms may be related by symmetry operations. The distance between given atoms and atoms generated by symmetry operations is compared to this threshold to determine if they are the same. If they are the same, then the coordinates are cleaned up to make them exactly symmetry equivalent. If the given molecule was produced by an optimization that started inC1symmetry, but produced a roughly symmetric structure and you would like to begin using symmetry, then this may need to be increased a bit to properly symmetrize the molecule. πsymmetry_frameβdouble[3][3], default[[1 0 0][0 1 0][0 0 1]]β the symmetry frame. Ignored forsymmetry = auto. πoriginβdouble[3], default[0 0 0]β the origin of the symmetry frame. Ignored forsymmetry = auto. β¨redundant_atomsβ boolean, defaultfalseβ iftrue, do not generate symmetry equivalent atoms; they are already given in the input. It should not be necessary to specify this option, since, by default, if a symmetry operation duplicates an atom, the generated atom will not be added to the list of atoms. Ignored forsymmetry = auto. π«pdb_fileβ string, defaultundefinedβ this gives the name of a PDB file, from which the nuclear coordinates will be read. If this is given, the following options will be ignored. π
β οΈ when pdb_file is set, the options listed after it in this roster are ignored β so don't expect them to do anything, bestie.
unitβ string, defaultbohrβ this gives the name of the units used for the geometry. See theUnitsclass for information about the known units. This replaces deprecated keywords that are still recognized:angstromandangstroms. This is ignored ifpdb_fileis given. πgeometryβdouble[][3], defaultnoneβ this gives the Cartesian coordinates of the molecule. This is ignored ifpdb_fileis given. π§atomsβstring[], defaultnoneβ this gives the Cartesian coordinates of the molecule. This is ignored ifpdb_fileis given. π§¬ghostβboolean[], defaultnoneβ iftrue, the atom will be given zero charge. It will still have basis functions, however. This is used to estimate basis set superposition error. This is ignored ifpdb_fileis given. π»chargeβdouble[], defaultZ for each atomβ allows specification of the charge for each atom. This is ignored ifpdb_fileis given. β‘atom_labelsβstring[], defaultnoneβ this gives a user defined atom label for each atom. This is ignored ifpdb_fileis given. π·οΈmassβdouble[], defaultTaken from AtomInfo given by the atominfo keyword.β this gives a user defined mass for each atom. This is ignored ifpdb_fileis given. βοΈ
π§ Member Function Documentation π§
πΉ atom_at_position
int sc::Molecule::atom_at_position (double *, double tol = 0.05) const
Takes an (x, y, z) position and finds an atom within the given tolerance distance. If no atom is found, -1 is returned. π΅οΈββοΈ
πΉ atom_label_to_index
int sc::Molecule::atom_label_to_index (const char * label) const
Returns the index of the atom with the given label. If the label cannot be found, -1 is returned. π·οΈ
πΉ atom_to_unique
int sc::Molecule::atom_to_unique (int iatom) const [inline]
Converts an atom number to the number of its generating unique atom. The return value is in [0, nunique). π
πΉ atom_to_unique_offset
int sc::Molecule::atom_to_unique_offset (int iatom) const
Converts an atom number to the offset of this atom in the list of generated atoms. The unique atom itself gets offset 0. π―
πΉ charges
double* sc::Molecule::charges () const
Returns a double* containing the nuclear charges of the atoms. The caller is responsible for freeing the return value. π§Ύ
πΉ cleanup_molecule
void sc::Molecule::cleanup_molecule (double tol = 0.1)
This will try to carefully correct symmetry errors in molecules. If any atom is out of place by more than tol, abort will be called. π¨
β οΈ yes bestie, that's a realabortβ keep an eye on yourtol.
πΉ highest_point_group
Ref<PointGroup> sc::Molecule::highest_point_group (double tol = 1.0e-8) const
Find this molecule's true point group (limited to abelian groups). If the point group of this molecule is set to the highest point group, then the origin must first be set to the center of mass. πΈ
πΉ is_axis
int sc::Molecule::is_axis (SCVector3 & origin, SCVector3 & udirection, int order, double tol = 1.0e-8) const
Return 1 if this given axis is a symmetry element for the molecule. The direction vector must be a unit vector. π§
πΉ is_linear_planar
void sc::Molecule::is_linear_planar (int & linear, int & planar, double tol = 1.0e-5) const
Sets linear to 1 if the molecule is linear, 0 otherwise. Sets planar to 1 if the molecule is planar, 0 otherwise. π
πΉ is_plane
int sc::Molecule::is_plane (SCVector3 & origin, SCVector3 & uperp, double tol = 1.0e-8) const
Return 1 if the given plane is a symmetry element for the molecule. The perpendicular vector must be a unit vector. πͺ
πΉ label
const char* sc::Molecule::label (int atom) const
Returns the label explicitly assigned to atom. If no label has been assigned, then null is returned. π·οΈ
πΉ save_data_state
void sc::Molecule::save_data_state (StateOut &) [virtual]
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR initializes them. This must be implemented by the derived class if the class has data. πΎ
Reimplemented from sc::SavableState.
πΉ symmetrize
void sc::Molecule::symmetrize (double tol = 0.5)
If the molecule contains only symmetry unique atoms, this function will generate the other, redundant atoms. The redundant atom will only be generated if there is no other atoms within a distance of tol. If there is another atom and it is not identical, then abort will be called. π
π¨ another abort moment β if the atom overlap isn't identical, it's not gonna quietly fix it for you.
πΈ Author πΈ
Generated automatically by Doxygen for MPQC from the source code.
π and that's a wrap, bestie β this iconic little page is from version 2.3.1, dated Sun Oct 4 2020, and yeah, Doxygen generated it for MPQC from the source code. mwah πβ¨
π¦ where this page comes from
- ubuntu jammy: libsc-doc 2.3.1-21
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms