00001 #ifndef CCTBX_ADP_RESTRAINTS_ISOTROPIC_ADP_H
00002 #define CCTBX_ADP_RESTRAINTS_ISOTROPIC_ADP_H
00003
00004 #include <cctbx/error.h>
00005 #include <cctbx/adptbx.h>
00006 #include <scitbx/array_family/versa.h>
00007 #include <vector>
00008 #include <scitbx/array_family/shared.h>
00009 #include <cctbx/import_scitbx_af.h>
00010
00011 namespace cctbx { namespace adp_restraints {
00012
00013 struct isotropic_adp_proxy
00014 {
00016 isotropic_adp_proxy() {}
00017
00019 isotropic_adp_proxy(
00020 unsigned const& i_seq_,
00021 double weight_)
00022 :
00023 i_seq(i_seq_),
00024 weight(weight_)
00025 {}
00026
00028 unsigned i_seq;
00030 double weight;
00031 };
00032
00033 class isotropic_adp
00034 {
00035 public:
00037 isotropic_adp() {}
00038
00040 isotropic_adp(
00041 scitbx::sym_mat3<double> const& u_cart_,
00042 double weight_)
00043 :
00044 u_cart(u_cart_),
00045 weight(weight_)
00046 {
00047 init_deltas();
00048 }
00049
00051 isotropic_adp(
00052 af::const_ref<scitbx::sym_mat3<double> > const& u_cart_,
00053 isotropic_adp_proxy const& proxy);
00054
00055 scitbx::sym_mat3<double>
00056 deltas() { return deltas_; }
00057
00059 double residual() const;
00060
00063 double rms_deltas() const;
00064
00066 scitbx::sym_mat3<double>
00067 gradients() const;
00068
00070
00072 void
00073 add_gradients(
00074 af::ref<scitbx::sym_mat3<double> > const& gradients_aniso_cart,
00075 unsigned const& i_seqs) const;
00076
00078 scitbx::sym_mat3<double> u_cart;
00079 double weight;
00080
00081 protected:
00082 void init_deltas();
00083 scitbx::sym_mat3<double> deltas_;
00084
00085 };
00086
00096 double
00097 isotropic_adp_residual_sum(
00098 af::const_ref<scitbx::sym_mat3<double> > const& u_cart,
00099 af::const_ref<isotropic_adp_proxy> const& proxies,
00100 af::ref<scitbx::sym_mat3<double> > const& gradients_aniso_cart);
00101
00105 af::shared<double>
00106 isotropic_adp_residuals(
00107 af::const_ref<scitbx::sym_mat3<double> > const& u_cart,
00108 af::const_ref<isotropic_adp_proxy> const& proxies);
00109
00113 af::shared<double>
00114 isotropic_adp_deltas_rms(
00115 af::const_ref<scitbx::sym_mat3<double> > const& u_cart,
00116 af::const_ref<isotropic_adp_proxy> const& proxies);
00117
00118 }}
00119
00120 #endif