28 #ifndef _chemistry_molecule_molecule_h
29 #define _chemistry_molecule_molecule_h
31 #undef HAVE_OPENBABEL2 // Won't link on my machine. Remove this before committing to main branch
35 #include <mpqc_config.h>
36 #include <util/class/class.h>
37 #include <util/state/state.h>
38 #include <util/keyval/keyval.h>
39 #include <util/misc/units.h>
40 #include <math/symmetry/pointgrp.h>
41 #include <math/scmat/vector3.h>
42 #include <math/scmat/matrix.h>
43 #include <chemistry/molecule/atominfo.h>
44 #include <chemistry/molecule/atom.h>
46 #ifdef MPQC_NEW_FEATURES
47 #include <util/misc/xml.h>
48 #endif // MPQC_NEW_FEATURES
150 #ifdef MPQC_NEW_FEATURES
155 std::vector<Atom> atoms_;
159 double ref_origin_[3];
166 void init_symmetry_info(
double tol=0.5);
167 void clear_symmetry_info();
181 std::vector<int> q_atoms_;
182 std::vector<int> non_q_atoms_;
188 void throw_if_atom_duplicated(
int begin=0,
double tol = 1e-3);
308 void add_atom(
int Z,
double x,
double y,
double z,
309 const std::string &
label =
"",
double mass = 0.0,
310 int have_charge = 0,
double charge = 0.0,
311 int have_fragment = 0,
int fragment = 0);
313 const Atom& atom(
size_t i)
const {
return atoms_[i]; }
314 const std::vector<Atom>& atoms()
const {
return atoms_; }
318 virtual void print_parsedkeyval(std::ostream& =
ExEnv::out0(),
321 int number_atoms = 1)
const;
327 size_t natom()
const {
return atoms_.size(); }
329 int Z(
int atom)
const {
return atoms_[atom].Z(); }
330 double &r(
int atom,
int xyz) {
return atoms_[atom].r(xyz); }
331 const double &r(
int atom,
int xyz)
const {
return atoms_[atom].r(xyz); }
332 const double *r(
int atom)
const {
return atoms_[atom].r(); }
333 double mass(
int atom)
const;
336 const char *
label(
int atom)
const;
350 std::vector<double>
charges()
const;
353 double charge(
int iatom)
const;
356 bool is_Q(
int iatom)
const;
378 SCVector3 &udirection,
int order,
double tol=1.0e-8)
const;
382 int is_plane(SCVector3 &origin, SCVector3 &uperp,
double tol=1.0e-8)
const;
385 int has_inversion(SCVector3 &origin,
double tol = 1.0e-8)
const;
388 int is_linear(
double tolerance = 1.0e-5)
const;
390 int is_planar(
double tolerance = 1.0e-5)
const;
412 const double *position,
double* efield);
422 void symmetrize(
const Ref<PointGroup> &pg,
double tol = 0.5);
431 void translate(
const double *r);
433 void transform_to_principal_axes(
int trans_frame=1);
434 void transform_to_symmetry_frame();
435 void print_xyz(std::ostream& =
ExEnv::out0(),
const char *title =0)
const;
445 int nunique()
const {
return nuniq_; }
448 int unique(
int iuniq)
const {
return equiv_[iuniq][0]; }
452 int equivalent(
int iuniq,
int j)
const {
return equiv_[iuniq][j]; }
491 int q_atom(
int i)
const {
return q_atoms_[i]; }
511 #ifdef MPQC_NEW_FEATURES
512 virtual boost::property_tree::ptree& write_xml(boost::property_tree::ptree& parent,
const XMLWriter& writer);
517 void read_xyz(
const char *filename);
518 #ifdef HAVE_OPENBABEL2
519 void read_openbabel2(
const char *filename);
521 #endif // HAVE_OPENBABEL2
525 bool operator==(
const Molecule& mol1,
const Molecule& mol2);
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
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.
int nequivalent(int iuniq) const
Returns the number of atoms equivalent to iuniq.
Definition: molecule.h:450
int has_inversion(SCVector3 &origin, double tol=1.0e-8) const
Return 1 if the molecule has an inversion center.
int max_z()
Return the maximum atomic number.
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.
double total_charge() const
Returns the total nuclear charge.
bool any_atom_has_fragment() const
Determine if any of the atoms have a fragment label.
The Molecule class contains information about molecules.
Definition: molecule.h:149
const Ref< PointGroup > & point_group() const
Returns the PointGroup of the molecule.
int atom_label_to_index(const std::string &label) const
Returns the index of the atom with the given label.
Ref< Units > geometry_units() const
in which units Molecule was specified and in which units it will be reported
Definition: molecule.h:324
std::string atom_symbol(int iatom) const
Returns the element symbol of the atom.
A template class that maintains references counts.
Definition: ref.h:361
Atom represents an atom in a Molecule.
Definition: atom.h:47
int total_Z() const
Returns the sum of atomic numbers of nuclei.
int n_q_atom() const
Retrieve the number of "Q" atoms.
Definition: molecule.h:489
int atom_to_unique(int iatom) const
Converts an atom number to the number of its generating unique atom.
Definition: molecule.h:455
int is_linear(double tolerance=1.0e-5) const
Returns 1 if the molecule is linear, 0 otherwise.
SCVector3 center_of_mass() const
Returns a SCVector3 containing the cartesian coordinates of the center of mass for the molecule.
void add_atom(int Z, double x, double y, double z, const std::string &label="", double mass=0.0, int have_charge=0, double charge=0.0, int have_fragment=0, int fragment=0)
Add an AtomicCenter to the Molecule.
std::vector< double > charges() const
Returns a vector of the nuclear charges of the atoms.
int is_planar(double tolerance=1.0e-5) const
Returns 1 if the molecule is planar, 0 otherwise.
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.
double nuclear_repulsion_energy()
Returns the nuclear repulsion energy for the molecule.
int non_q_atom(int i) const
Retrieve the of non-"Q" atoms.
Definition: molecule.h:496
bool any_atom_has_label() const
Determine if any of the atoms have a user defined label.
bool include_q() const
Returns include_q. See set_include_q.
Definition: molecule.h:480
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:478
int n_non_q_atom() const
Retrieve the number of non-"Q" atoms.
Definition: molecule.h:494
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 fragment(int atom) const
returns the fragment to which atom belongs to
void principal_moments_of_inertia(double *evals, double **evecs=0) const
Compute the principal moments of inertia and, possibly, the principal axes.
std::string atom_name(int iatom) const
Returns the element name of the 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.
void cleanup_molecule(double tol=0.1)
This will try to carefully correct symmetry errors in molecules.
bool include_qq() const
Returns include_qq. See set_include_qq.
Definition: molecule.h:486
void symmetrize(double tol=0.5)
If the molecule contains only symmetry unique atoms, this function will generate the other,...
int nunique() const
Return information about symmetry unique and equivalent atoms.
Definition: molecule.h:446
virtual void print(std::ostream &=ExEnv::out0()) const
Print information about the molecule.
Definition: stateout.h:71
bool is_Q(int iatom) const
Return true if iatom is a simple point charge.
double charge(int iatom) const
Return the charge of the atom.
Definition: xmlwriter.h:215
Ref< AtomInfo > atominfo() const
Return the molecule's AtomInfo object.
Definition: molecule.h:468
int n_core_electrons()
Return the number of core electrons.
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:484
const char * label(int atom) const
Returns the label explicitly assigned to atom.
int q_atom(int i) const
Retrieve the "Q" atoms.
Definition: molecule.h:491
a 3-element version of SCVector
Definition: vector3.h:43
static std::ostream & out0()
Return an ostream that writes from node 0.
void nuclear_repulsion_1der(int center, double xyz[3])
Compute the nuclear repulsion energy first derivative with respect to the given center.
size_t natom() const
Returns the number of atoms in the molecule.
Definition: molecule.h:327
Base class for objects that can save/restore state.
Definition: state.h:45
Ref< PointGroup > highest_point_group(double tol=1.0e-8) const
Find this molecules true point group (limited to abelian groups).
void nuclear_efield(const double *position, double *efield)
Compute the electric field due to the nuclei at the given point.
bool operator==(const Atom &a, const Atom &b)
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 equivalent(int iuniq, int j) const
Returns the j'th atom equivalent to iuniq.
Definition: molecule.h:452
Contains all MPQC code up to version 3.
Definition: mpqcin.h:14
SCVector3 ref_origin() const
returns the origin of the reference coordinate system (the system in which atoms were specified befor...
Definition: molecule.h:507
int unique(int iuniq) const
Returns the overall number of the iuniq'th unique atom.
Definition: molecule.h:448
bool any_atom_has_charge() const
Determine if any of the atoms have non-standard charge.
void set_point_group(const Ref< PointGroup > &, double tol=1.0e-7)
Sets the PointGroup of the molecule.
Generated at Sun Jan 26 2020 23:23:57 for MPQC
3.0.0-alpha using the documentation package Doxygen
1.8.16.