28 #ifndef _chemistry_molecule_molecule_h
29 #define _chemistry_molecule_molecule_h
37 #include <util/class/class.h>
38 #include <util/state/state.h>
39 #include <util/keyval/keyval.h>
40 #include <util/misc/units.h>
41 #include <math/symmetry/pointgrp.h>
42 #include <math/scmat/vector3.h>
43 #include <math/scmat/matrix.h>
44 #include <chemistry/molecule/atominfo.h>
143 void init_symmetry_info(
double tol=0.5);
144 void clear_symmetry_info();
162 std::vector<int> q_atoms_;
163 std::vector<int> non_q_atoms_;
169 void throw_if_atom_duplicated(
int begin=0,
double tol = 1e-3);
276 void add_atom(
int Z,
double x,
double y,
double z,
277 const char * = 0,
double mass = 0.0,
278 int have_charge = 0,
double charge = 0.0);
282 virtual void print_parsedkeyval(std::ostream& =
ExEnv::out0(),
285 int number_atoms = 1)
const;
288 int natom()
const {
return natoms_; }
290 int Z(
int atom)
const {
return Z_[atom]; }
291 double &r(
int atom,
int xyz) {
return r_[atom][xyz]; }
292 const double &r(
int atom,
int xyz)
const {
return r_[atom][xyz]; }
293 double *r(
int atom) {
return r_[atom]; }
294 const double *r(
int atom)
const {
return r_[atom]; }
295 double mass(
int atom)
const;
298 const char *
label(
int atom)
const;
314 double charge(
int iatom)
const;
332 SCVector3 &udirection,
int order,
double tol=1.0e-8)
const;
336 int is_plane(SCVector3 &origin, SCVector3 &uperp,
double tol=1.0e-8)
const;
339 int has_inversion(SCVector3 &origin,
double tol = 1.0e-8)
const;
342 int is_linear(
double tolerance = 1.0e-5)
const;
344 int is_planar(
double tolerance = 1.0e-5)
const;
366 const double *position,
double* efield);
376 void symmetrize(
const Ref<PointGroup> &pg,
double tol = 0.5);
383 void translate(
const double *r);
385 void transform_to_principal_axes(
int trans_frame=1);
386 void transform_to_symmetry_frame();
387 void print_pdb(std::ostream& =
ExEnv::out0(),
char *title =0)
const;
389 void read_pdb(
const char *filename);
398 int unique(
int iuniq)
const {
return equiv_[iuniq][0]; }
402 int equivalent(
int iuniq,
int j)
const {
return equiv_[iuniq][j]; }
440 int q_atom(
int i)
const {
return q_atoms_[i]; }
int equivalent(int iuniq, int j) const
Returns the j'th atom equivalent to iuniq.
Definition: molecule.h:402
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.
Ref< PointGroup > highest_point_group(double tol=1.0e-8) const
Find this molecules true point group (limited to abelian groups).
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
std::string atom_name(int iatom) const
Returns the element name of the atom.
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 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
Sets linear to 1 if the molecular is linear, 0 otherwise.
bool include_q() const
Returns include_q. See set_include_q.
Definition: molecule.h:429
Serializes objects that derive from SavableState.
Definition: stateout.h:61
int nequivalent(int iuniq) const
Returns the number of atoms equivalent to iuniq.
Definition: molecule.h:400
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...
int unique(int iuniq) const
Returns the overall number of the iuniq'th unique atom.
Definition: molecule.h:398
bool include_qq() const
Returns include_qq. See set_include_qq.
Definition: molecule.h:435
void set_include_q(bool iq)
If include_q is true, then include the "Q" atoms in the charge and efield routines.
Definition: molecule.h:427
int q_atom(int i) const
Retrieve the "Q" atoms.
Definition: molecule.h:440
A template class that maintains references counts.
Definition: ref.h:332
double nuclear_repulsion_energy()
Returns the nuclear repulsion energy for the molecule.
int is_linear(double tolerance=1.0e-5) const
Returns 1 if the molecule is linear, 0 otherwise.
int atom_to_unique(int iatom) const
Converts an atom number to the number of its generating unique atom.
Definition: molecule.h:405
Ref< PointGroup > point_group() const
Returns the PointGroup of the molecule.
void principal_moments_of_inertia(double *evals, double **evecs=0) const
Compute the principal moments of inertia and, possibly, the principal axes.
int atom_to_unique_offset(int iatom) const
Converts an atom number to the offset of this atom in the list of generated atoms.
void cleanup_molecule(double tol=0.1)
This will try to carefully correct symmetry errors in molecules.
Restores objects that derive from SavableState.
Definition: statein.h:70
int has_inversion(SCVector3 &origin, double tol=1.0e-8) const
Return 1 if the molecule has an inversion center.
std::string atom_symbol(int iatom) const
Returns the element symbol of the atom.
void symmetrize(double tol=0.5)
If the molecule contains only symmetry unique atoms, this function will generate the other...
SCVector3 center_of_mass() const
Returns a SCVector3 containing the cartesian coordinates of the center of mass for the molecule...
int atom_label_to_index(const char *label) const
Returns the index of the atom with the given label.
static std::ostream & out0()
Return an ostream that writes from node 0.
int atom_at_position(double *, double tol=0.05) const
Takes an (x, y, z) postion and finds an atom within the given tolerance distance. ...
double nuclear_charge() const
Returns the total nuclear charge.
int non_q_atom(int i) const
Retrieve the of non-"Q" atoms.
Definition: molecule.h:445
int nunique() const
Return information about symmetry unique and equivalent atoms.
Definition: molecule.h:396
void set_include_qq(bool iqq)
If include_qq is true, include the coupling between pairs of "Q" atoms when computing nuclear repulsi...
Definition: molecule.h:433
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.
int n_core_electrons()
Return the number of core electrons.
int natom() const
Returns the number of atoms in the molcule.
Definition: molecule.h:288
The Molecule class contains information about molecules.
Definition: molecule.h:127
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 n_non_q_atom() const
Retrieve the number of non-"Q" atoms.
Definition: molecule.h:443
Ref< AtomInfo > atominfo() const
Return the molecule's AtomInfo object.
Definition: molecule.h:417
double charge(int iatom) const
Return the charge of the atom.
double * charges() const
Returns a double* containing the nuclear charges of the atoms.
Base class for objects that can save/restore state.
Definition: state.h:46
int max_z()
Return the maximum atomic number.
void set_point_group(const Ref< PointGroup > &, double tol=1.0e-7)
Sets the PointGroup of the molecule.
const char * label(int atom) const
Returns the label explicitly assigned to atom.
virtual void print(std::ostream &=ExEnv::out0()) const
Print information about the molecule.
int n_q_atom() const
Retrieve the number of "Q" atoms.
Definition: molecule.h:438