24 #include "wx/wxprec.h" 
   32 #include "ObjCryst/wxCryst/wxZScatterer.h" 
   33 #include "ObjCryst/ObjCryst/Molecule.h" 
   53    VFN_DEBUG_ENTRY(
"ZScatterer2Molecule()",6)
 
   57    for(
unsigned int i=0;i<nb;++i)
 
   72                                                        .GetObj(i).GetZBondLength())));
 
   73          if(pLength->IsFixed())
 
   77             if(pLength->IsLimited())
 
   84                                                       .GetObj(i).GetZAngle())));
 
   90             if(pAngle->IsLimited())
 
   98                                                       .GetObj(i).GetZDihedralAngle())));
 
  108             if(pDihed->IsFixed())
 
  111                if(((pDihed->
GetMax()-pDihed->
GetMax())<0.3)&&(i>2)&&(pDihed->IsLimited()))
 
  117       mol->GetAtom(i).SetOccupancy(scatt->
GetZAtomRegistry().GetObj(i).GetOccupancy());
 
  120    CrystVector_REAL x(nb),y(nb),z(nb),radius(nb);
 
  121    vector<pair<const ScatteringPowerAtom *,long> > scattpow(nb);
 
  122    for(
unsigned int i=0;i<nb;++i)
 
  124       x(i)=mol->GetAtom(i).GetX();
 
  125       y(i)=mol->GetAtom(i).GetY();
 
  126       z(i)=mol->GetAtom(i).GetZ();
 
  134          radius(i)=mol->GetAtom(i).GetScatteringPower().
GetRadius();
 
  136                              (&(mol->GetAtom(i).GetScatteringPower()));
 
  140    for(
unsigned int i=0;i<nb;++i)
 
  142       if(scattpow[i].first==0) 
continue;
 
  143       const REAL x1=x(i),y1=y(i),z1=z(i);
 
  147       for(
unsigned int j=i+1;j<nb;++j)
 
  149          if(scattpow[j].first==0) 
continue;
 
  150          const REAL dist=sqrt(x(j)*x(j)+y(j)*y(j)+z(j)*z(j));
 
  152          if(dist<(1.10*(radius(i)+radius(j))))
 
  154             if((1!=scattpow[i].second)||(1!=scattpow[j].second))
 
  156                   mol->
AddBond(mol->GetAtom(i),mol->GetAtom(j),dist,.01,.02,
false);
 
  168       for(set<MolAtom*>::const_iterator pos1=pos->second.begin();
 
  169           pos1!=pos->second.end();++pos1)
 
  171          for(set<MolAtom*>::const_iterator pos2=pos1;
 
  172           pos2!=pos->second.end();++pos2)
 
  174             if(pos2==pos1) 
continue;
 
  175             if(mol->
FindBondAngle(**pos1,*(pos->first),**pos2)== mol->GetBondAngleList().end())
 
  177                                  GetBondAngle(**pos1,*(pos->first),**pos2),0.01,0.02,
false);
 
  189    VFN_DEBUG_EXIT(
"ZScatterer2Molecule()",6)
 
  198 static const long ID_ZATOM_NAME=    WXCRYST_ID();
 
  199 static const long ID_ZATOM_SCATTPOW=WXCRYST_ID();
 
  200 static const long ID_ZATOM_BOND=    WXCRYST_ID();
 
  201 static const long ID_ZATOM_ANGLE=   WXCRYST_ID();
 
  202 static const long ID_ZATOM_DIHED=   WXCRYST_ID();
 
  204 BEGIN_EVENT_TABLE(WXZAtom,wxWindow)
 
  205    EVT_BUTTON(ID_ZATOM_SCATTPOW,    WXZAtom::OnChangeScattPow)
 
  208 WXZAtom::WXZAtom(wxWindow* parent, ZAtom *obj):
 
  209 WXCrystObjBasic(parent),mpZAtom(obj)
 
  211    VFN_DEBUG_ENTRY(
"WXZAtom::WXZAtom()",6)
 
  212    mpSizer=new wxBoxSizer(wxHORIZONTAL);
 
  214    mpFieldName=new WXFieldString(this, mpZAtom->mName,ID_ZATOM_NAME,80,true);
 
  215    mpSizer->Add(mpFieldName,0,wxALIGN_LEFT);
 
  216    mpFieldScattPower=new WXFieldChoice(this,ID_ZATOM_SCATTPOW,"Type:",60);
 
  217    mpSizer->Add(mpFieldScattPower,0,wxALIGN_LEFT);
 
  218    mList.Add(mpFieldScattPower);
 
  220    if(0<mpZAtom->GetZScatterer().GetZAtomRegistry().Find(*mpZAtom))
 
  222       RefinablePar *par=&(mpZAtom->GetZScatterer().GetPar(&(mpZAtom->mBondLength)));
 
  223       par->SetName(
"Bond(w/"+(mpZAtom->GetZScatterer().GetZAtomRegistry()
 
  224                      .GetObj(mpZAtom->GetZBondAtom())).GetName()+
")");
 
  225       WXCrystObjBasic* pFieldBond=par->WXCreate(
this);
 
  226       mpSizer->Add(pFieldBond,0,wxALIGN_LEFT);
 
  227       mList.Add(pFieldBond);
 
  230    if(1<mpZAtom->GetZScatterer().GetZAtomRegistry().Find(*mpZAtom))
 
  232       RefinablePar *par=&(mpZAtom->GetZScatterer().GetPar(&(mpZAtom->mAngle)));
 
  233       par->SetName(
"Angle(w/"+(mpZAtom->GetZScatterer().GetZAtomRegistry()
 
  234                      .GetObj(mpZAtom->GetZAngleAtom())).GetName()+
")");
 
  235        WXCrystObjBasic* pFieldAngle
 
  236           =par->WXCreate(
this);
 
  237       mpSizer->Add(pFieldAngle,0,wxALIGN_LEFT);
 
  238       mList.Add(pFieldAngle);
 
  240    if(2<mpZAtom->GetZScatterer().GetZAtomRegistry().Find(*mpZAtom))
 
  242       RefinablePar *par=&(mpZAtom->GetZScatterer().GetPar(&(mpZAtom->mDihed)));
 
  243       par->SetName(
"DihedralAngle(w/"+(mpZAtom->GetZScatterer().GetZAtomRegistry()
 
  244                      .GetObj(mpZAtom->GetZDihedralAngleAtom())).GetName()+
")");
 
  245       WXCrystObjBasic* pFieldDihed=par->WXCreate(
this);
 
  246       mpSizer->Add(pFieldDihed,0,wxALIGN_LEFT);
 
  247       mList.Add(pFieldDihed);
 
  250       RefinablePar *par=&(mpZAtom->GetZScatterer().GetPar(&(mpZAtom->mOccupancy)));
 
  251       par->SetName(
"Occup.");
 
  252       WXCrystObjBasic* pFieldOccup=par->WXCreate(
this);
 
  253       mpSizer->Add(pFieldOccup,0,wxALIGN_LEFT);
 
  254       mList.Add(pFieldOccup);
 
  257    this->SetSizer(mpSizer);
 
  259    this->BottomLayout(0);
 
  260    this->CrystUpdate(
true);
 
  261    VFN_DEBUG_EXIT(
"WXZAtom::WXZAtom()",6)
 
  266    VFN_DEBUG_ENTRY(
"WXZAtom::CrystUpdate()",6)
 
  270    VFN_DEBUG_EXIT(
"WXZAtom::CrystUpdate()",6)
 
  275    VFN_DEBUG_ENTRY(
"WXZAtom::UpdateUI()",6)
 
  278    mpFieldName->SetValue(mpZAtom->GetName().c_str());
 
  279    if(0!=mpZAtom->GetScatteringPower())
 
  280       mpFieldScattPower->SetValue(mpZAtom->GetScatteringPower()->GetName());
 
  282       mpFieldScattPower->SetValue(
"Dummy");
 
  284    VFN_DEBUG_EXIT(
"WXZAtom::UpdateUI()",6)
 
  287 void WXZAtom::OnChangeScattPow(wxCommandEvent & WXUNUSED(event))
 
  289    VFN_DEBUG_MESSAGE(
"WXAtom::OnChangeScattPow()",6)
 
  293                mpZAtom->GetZScatterer().GetCrystal().GetScatteringPowerRegistry(),
 
  294                (wxWindow*)this,"Choose a new Scattering Power",choice);
 
  296    mpZAtom->SetScatteringPower(scatt);
 
  305 static const 
long ID_ZSCATTERER_MENU_ATOM=                  
WXCRYST_ID();
 
  306 static const 
long ID_ZSCATTERER_MENU_ATOM_ADD=              WXCRYST_ID();
 
  307 static const 
long ID_ZSCATTERER_MENU_ATOM_CHANGE_PIVOT=     WXCRYST_ID();
 
  308 static const 
long ID_ZSCATTERER_MENU_PAR_LIMITS_RELAT_BOND= WXCRYST_ID();
 
  309 static const 
long ID_ZSCATTERER_MENU_PAR_LIMITS_RELAT_ANGLE=WXCRYST_ID();
 
  310 static const 
long ID_ZSCATTERER_MENU_PAR_LIMITS_RELAT_DIHED=WXCRYST_ID();
 
  311 static const 
long ID_ZSCATTERER_MENU_FILE=                  WXCRYST_ID();
 
  312 static const 
long ID_ZSCATTERER_MENU_IMPORT_FHZ=            WXCRYST_ID();
 
  313 static const 
long ID_ZSCATTERER_MENU_EXPORT_FHZ=            WXCRYST_ID();
 
  314 static const 
long ID_ZSCATTERER_MENU_CONVERT2MOLECULE=     WXCRYST_ID();
 
  316    EVT_BUTTON(ID_WXOBJ_COLLAPSE,                       
WXCrystObj::OnToggleCollapse)
 
  317    EVT_MENU(ID_REFOBJ_MENU_PAR_FIXALL,                 
WXRefinableObj::OnMenuFixAllPar)
 
  318    EVT_MENU(ID_REFOBJ_MENU_PAR_UNFIXALL,               
WXRefinableObj::OnMenuUnFixAllPar)
 
  319    EVT_MENU(ID_REFOBJ_MENU_PAR_RANDOMIZE,              
WXRefinableObj::OnMenuParRandomize)
 
  320    EVT_MENU(ID_ZSCATTERER_MENU_PAR_LIMITS_RELAT_BOND,  WXZScatterer::OnMenuSetLimits)
 
  321    EVT_MENU(ID_ZSCATTERER_MENU_PAR_LIMITS_RELAT_ANGLE, WXZScatterer::OnMenuSetLimits)
 
  322    EVT_MENU(ID_ZSCATTERER_MENU_PAR_LIMITS_RELAT_DIHED, WXZScatterer::OnMenuSetLimits)
 
  323    EVT_MENU(ID_ZSCATTERER_MENU_ATOM_ADD,               WXZScatterer::OnMenuAddZAtom)
 
  324    EVT_MENU(ID_ZSCATTERER_MENU_ATOM_CHANGE_PIVOT,      WXZScatterer::OnMenuChangePivotAtom)
 
  325    EVT_MENU(ID_ZSCATTERER_MENU_IMPORT_FHZ,             WXZScatterer::OnMenuImportZMatrix)
 
  326    EVT_MENU(ID_ZSCATTERER_MENU_EXPORT_FHZ,             WXZScatterer::OnMenuExportZMatrix)
 
  327    EVT_MENU(ID_ZSCATTERER_MENU_CONVERT2MOLECULE,       WXZScatterer::OnMenuConvert2Molecule)
 
  330 WXZScatterer::WXZScatterer(wxWindow* parent, 
ZScatterer *obj):
 
  333    VFN_DEBUG_MESSAGE(
"WXZScatterer::WXZScatterer()",6)
 
  335       mpMenuBar->AddMenu("Import/Export",ID_ZSCATTERER_MENU_FILE);
 
  336          mpMenuBar->AddMenuItem(ID_ZSCATTERER_MENU_FILE,
 
  337                                 ID_ZSCATTERER_MENU_IMPORT_FHZ,
 
  338                                 "Import Fenske-Hall Zmatrix");
 
  339          mpMenuBar->AddMenuItem(ID_ZSCATTERER_MENU_FILE,
 
  340                                 ID_ZSCATTERER_MENU_EXPORT_FHZ,
 
  341                                 "Save as Fenske-Hall Zmatrix");
 
  342          mpMenuBar->AddMenuItem(ID_ZSCATTERER_MENU_FILE,
 
  343                                 ID_ZSCATTERER_MENU_CONVERT2MOLECULE,
 
  345       mpMenuBar->AddMenu("Parameters",ID_REFOBJ_MENU_PAR);
 
  346          mpMenuBar->AddMenuItem(ID_REFOBJ_MENU_PAR,ID_REFOBJ_MENU_PAR_FIXALL,"Fix all");
 
  347          mpMenuBar->AddMenuItem(ID_REFOBJ_MENU_PAR,ID_REFOBJ_MENU_PAR_UNFIXALL,"Unfix all");
 
  348          mpMenuBar->AddMenuItem(ID_REFOBJ_MENU_PAR,ID_REFOBJ_MENU_PAR_RANDOMIZE,
 
  349                                 "Randomize Configuration");
 
  350          mpMenuBar->AddMenuItem(ID_REFOBJ_MENU_PAR,ID_ZSCATTERER_MENU_PAR_LIMITS_RELAT_BOND,
 
  351                                 "Set limits (relative) on all bondlengths");
 
  352          mpMenuBar->AddMenuItem(ID_REFOBJ_MENU_PAR,ID_ZSCATTERER_MENU_PAR_LIMITS_RELAT_ANGLE,
 
  353                                 "Set limits (relative) on all bond angles");
 
  354          mpMenuBar->AddMenuItem(ID_REFOBJ_MENU_PAR,ID_ZSCATTERER_MENU_PAR_LIMITS_RELAT_DIHED,
 
  355                                 "Set limits (relative) on all dihedral angles");
 
  356       mpMenuBar->AddMenu("
Atom",ID_ZSCATTERER_MENU_ATOM);
 
  357          mpMenuBar->AddMenuItem(ID_ZSCATTERER_MENU_ATOM,ID_ZSCATTERER_MENU_ATOM_ADD,
 
  359          mpMenuBar->AddMenuItem(ID_ZSCATTERER_MENU_ATOM,ID_ZSCATTERER_MENU_ATOM_CHANGE_PIVOT,
 
  360                                 "Change Pivot Atom");
 
  365       wxBoxSizer* sizer=new wxBoxSizer(wxHORIZONTAL);
 
  367       WXCrystObjBasic* pFieldPhi =mpZScatterer->GetPar(&(mpZScatterer->mPhi)).WXCreate(this);
 
  368       WXCrystObjBasic* pFieldChi =mpZScatterer->GetPar(&(mpZScatterer->mChi)).WXCreate(this);
 
  369       WXCrystObjBasic* pFieldPsi =mpZScatterer->GetPar(&(mpZScatterer->mPsi)).WXCreate(this);
 
  371       sizer->Add(pFieldPhi    ,0,wxALIGN_CENTER);
 
  372       sizer->Add(pFieldChi    ,0,wxALIGN_CENTER);
 
  373       sizer->Add(pFieldPsi    ,0,wxALIGN_CENTER);
 
  375       mpSizer->Add(sizer,0,wxALIGN_LEFT);
 
  376       mList.Add(pFieldPhi);
 
  377       mList.Add(pFieldChi);
 
  378       mList.Add(pFieldPsi);
 
  380       mpWXZAtomRegistry=mpZScatterer->mZAtomRegistry.WXCreate(this);
 
  381       mpSizer->Add(mpWXZAtomRegistry,0,wxALIGN_LEFT);
 
  382       mList.Add(mpWXZAtomRegistry);
 
  384    this->BottomLayout(0);
 
  388 void WXZScatterer::OnMenuAddZAtom(wxCommandEvent & WXUNUSED(event))
 
  390    VFN_DEBUG_ENTRY(
"WXZScatterer::OnMenuAddZAtom()",6)
 
  402                                  mpZScatterer->GetCrystal().GetScatteringPowerRegistry(),
 
  406          VFN_DEBUG_EXIT(
"WXZScatterer::OnMenuAddZAtom():Cancelled",6)
 
  410    if(0<mpZScatterer->GetZAtomRegistry().GetNb())
 
  414                                                  this,
"Choose the bonded atom",bondAtomId);
 
  417          VFN_DEBUG_EXIT(
"WXZScatterer::OnMenuAddZAtom():Cancelled",6)
 
  421       wxTextEntryDialog bondLengthDialog(this,_T("Enter bond length (Angstroems)"),
 
  422                               _T("Bond length"),_T("1.5"),wxOK | wxCANCEL);
 
  423       if(wxID_OK!=bondLengthDialog.ShowModal())
 
  425          VFN_DEBUG_EXIT(
"WXZScatterer::OnMenuAddZAtom():Cancelled",6)
 
  428       bondLengthDialog.GetValue().ToDouble(&bondLength);
 
  431    if(1<mpZScatterer->GetZAtomRegistry().GetNb())
 
  434                                                  this,
"Angle Atom",angleAtomId);
 
  437          VFN_DEBUG_EXIT(
"WXZScatterer::OnMenuAddZAtom():Cancelled",6)
 
  441       wxTextEntryDialog angleDialog(this,_T("Enter bond angle (degrees)"),
 
  442                               _T("Bond Angle"),_T("110"),wxOK | wxCANCEL);
 
  443       if(wxID_OK!=angleDialog.ShowModal())
 
  445          VFN_DEBUG_EXIT(
"WXZScatterer::OnMenuAddZAtom():Cancelled",6)
 
  448       angleDialog.GetValue().ToDouble(&angle);
 
  451    if(2<mpZScatterer->GetZAtomRegistry().GetNb())
 
  454                                                  this,
"Dihedral angle Atom",dihedAtomId);
 
  457          VFN_DEBUG_EXIT(
"WXZScatterer::OnMenuAddZAtom():Cancelled",6)
 
  461       wxTextEntryDialog dihedDialog(this,_T("Enter dihedral angle (degrees)"),
 
  462                               _T("Dihedral Angle"),_T("0"),wxOK | wxCANCEL);
 
  463       if(wxID_OK!=dihedDialog.ShowModal())
 
  465          VFN_DEBUG_EXIT(
"WXZScatterer::OnMenuAddZAtom():Cancelled",6)
 
  468       dihedDialog.GetValue().ToDouble(&dihed);
 
  471    if(1<mpZScatterer->GetZAtomRegistry().GetNb())
 
  472       if(bondAtomId==angleAtomId)
 
  474          wxMessageDialog dumbUser(
this,_T(
"Bond, angle an dihedral atoms *must* be different"),
 
  475                                   _T(
"Whooops"),wxOK|wxICON_EXCLAMATION);
 
  476          dumbUser.ShowModal();
 
  479    if(2<mpZScatterer->GetZAtomRegistry().GetNb())
 
  480       if((bondAtomId==angleAtomId)||(bondAtomId==dihedAtomId)||(angleAtomId==dihedAtomId))
 
  482          wxMessageDialog dumbUser(
this,_T(
"Bond, angle an dihedral atoms *must* be different"),
 
  483                                   _T(
"Whooops"),wxOK|wxICON_EXCLAMATION);
 
  484          dumbUser.ShowModal();
 
  488    sprintf(buf,
"%d",mpZScatterer->GetNbComponent()+1);
 
  489    mpZScatterer->AddAtom (scattPow->GetName()+(string)buf,
 
  491                            bondAtomId,bondLength,
 
  492                            angleAtomId,angle*DEG2RAD,
 
  493                            dihedAtomId,dihed*DEG2RAD,
 
  496    VFN_DEBUG_EXIT(
"WXZScatterer::OnMenuAddZAtom()",6)
 
  499 void WXZScatterer::OnMenuSetLimits(wxCommandEvent & event)
 
  501    VFN_DEBUG_ENTRY(
"WXZScatterer::OnMenuSetLimits()",6)
 
  503    if(event.GetId()==ID_ZSCATTERER_MENU_PAR_LIMITS_RELAT_BOND)
 
  506       wxTextEntryDialog limitDialog(
this,_T(
"Enter maximum shift in Angstroems\n The limits are taken symmetrically around current position:\n X0-l < X < X0+l "),
 
  507                               _T(
"Set limits (relative) for bondlengths"),_T(
".1"),wxOK | wxCANCEL);
 
  508       if(wxID_OK!=limitDialog.ShowModal())
 
  510          VFN_DEBUG_EXIT(
"WXZScatterer::OnMenuSetLimits():Cancelled",6)
 
  513       limitDialog.GetValue().ToDouble(&limit);
 
  516          wxMessageDialog dumbUser(
this,_T(
"Limit must be > 0 !"),
 
  517                                   _T(
"Whooops"),wxOK|wxICON_EXCLAMATION);
 
  518          dumbUser.ShowModal();
 
  521       mpZScatterer->SetLimitsRelative(gpRefParTypeScattConformBondLength,-limit,limit);
 
  523    if(event.GetId()==ID_ZSCATTERER_MENU_PAR_LIMITS_RELAT_ANGLE)
 
  526       wxTextEntryDialog limitDialog(
this,_T(
"Enter maximum shift in Degrees\n The limits are taken symmetrically around current position:\n X0-l < X < X0+l "),
 
  527                               _T(
"Set limits (relative) for bond angles"),_T(
".1"),wxOK | wxCANCEL);
 
  528       if(wxID_OK!=limitDialog.ShowModal())
 
  530          VFN_DEBUG_EXIT(
"WXZScatterer::OnMenuSetLimits():Cancelled",6)
 
  533       limitDialog.GetValue().ToDouble(&limit);
 
  536          wxMessageDialog dumbUser(
this,_T(
"Limit must be > 0 !"),
 
  537                                   _T(
"Whooops"),wxOK|wxICON_EXCLAMATION);
 
  538          dumbUser.ShowModal();
 
  542       mpZScatterer->SetLimitsRelative(gpRefParTypeScattConformBondAngle,-limit,limit);
 
  544    if(event.GetId()==ID_ZSCATTERER_MENU_PAR_LIMITS_RELAT_DIHED)
 
  547       wxTextEntryDialog limitDialog(
this,_T(
"Enter maximum shift in Degrees\n The limits are taken symmetrically around current position:\n X0-l < X < X0+l "),
 
  548                               _T(
"Set limits (relative) for dihedral angles"),_T(
".1"),wxOK | wxCANCEL);
 
  549       if(wxID_OK!=limitDialog.ShowModal())
 
  551          VFN_DEBUG_EXIT(
"WXZScatterer::OnMenuSetLimits():Cancelled",6)
 
  554       limitDialog.GetValue().ToDouble(&limit);
 
  557          wxMessageDialog dumbUser(
this,_T(
"Limit must be > 0 !"),
 
  558                                   _T(
"Whooops"),wxOK|wxICON_EXCLAMATION);
 
  559          dumbUser.ShowModal();
 
  563       mpZScatterer->SetLimitsRelative(gpRefParTypeScattConformDihedAngle,-limit,limit);
 
  567 void WXZScatterer::OnMenuChangePivotAtom(wxCommandEvent &WXUNUSED(event))
 
  570    int pivot=mpZScatterer->mCenterAtomIndex;
 
  572                                               this,
"Choose the new Pivot atom",pivot);
 
  575       VFN_DEBUG_EXIT(
"WXZScatterer::OnMenuAddZAtom():Cancelled",6)
 
  578    mpZScatterer->mCenterAtomIndex=pivot;
 
  579    mpZScatterer->mClockScatterer.Click();
 
  582 void WXZScatterer::OnMenuImportZMatrix(wxCommandEvent &WXUNUSED(event))
 
  584    wxFileDialog open(
this,_T(
"Choose a file"),_T(
""),_T(
""),_T(
"*.fhz"),
 
  585                                         wxFD_OPEN | wxFD_FILE_MUST_EXIST);
 
  586    if(open.ShowModal() != wxID_OK) 
return;
 
  587    ifstream fin (open.GetPath().ToAscii());
 
  590       throw ObjCrystException(
"WXZScatterer::OnMenuImportZMatrix() : \ 
  591 Error opening file for input:"+
string(open.GetPath().ToAscii()));
 
  593    mpZScatterer->ImportFenskeHallZMatrix(fin);
 
  596 void WXZScatterer::OnMenuExportZMatrix(wxCommandEvent &WXUNUSED(event))
 
  598    wxFileDialog save(
this,_T(
"Choose a file"),_T(
""),_T(
""),_T(
"*.fhz"),wxFD_SAVE);
 
  599    if(save.ShowModal() != wxID_OK) 
return;
 
  600    ofstream fout (save.GetPath().ToAscii());
 
  603       throw ObjCrystException(
"WXZScatterer::OnMenuExportZMatrix() : \ 
  604 Error opening file for input:"+
string(save.GetPath().ToAscii()));
 
  606    mpZScatterer->ExportFenskeHallZMatrix(fout);
 
  610 void WXZScatterer::OnMenuConvert2Molecule(wxCommandEvent &WXUNUSED(event))
 
  613    mpZScatterer->GetCrystal().RemoveScatterer(mpZScatterer);
 
  614    mol->GetCrystal().AddScatterer(mol);
 
T * WXDialogChooseFromRegistry(ObjRegistry< T > ®, wxWindow *parent, const string &message, int &choice)
This function allows to pick up one object in a registry. 
REAL GetZAtomY(const int i) const 
Get the Y fractionnal coordinate of atom i. 
REAL GetMin() const 
Minimum value allowed (if limited or periodic) 
void WXCrystValidateAllUserInput()
This function validates all user input (in a WXField) not yet taken into account, if needs be...
CrystMutex mMutex
Mutex used to lock data when preparing to update the UI in non-main thread. 
void OrthonormalToFractionalCoords(REAL &x, REAL &y, REAL &z) const 
Get fractional cartesian coordinates for a set of (x,y,z) orthonormal coordinates. 
REAL GetZAtomZ(const int i) const 
Get the Z fractionnal coordinate of atom i. 
void AddBondAngle(MolAtom &atom1, MolAtom &atom2, MolAtom &atom3, const REAL angle, const REAL sigma, const REAL delta, const bool updateDisplay=true)
Add a bond angle restraint. 
wxCryst class for ZScatterer objects 
RefinablePar & GetPar(const long i)
Access all parameters in the order they were inputted. 
virtual REAL GetRadius() const =0
Return the physical radius of this type of scatterer (for 3D display purposes). 
void AddDihedralAngle(MolAtom &atom1, MolAtom &atom2, MolAtom &atom3, MolAtom &atom4, const REAL angle, const REAL sigma, const REAL delta, const bool updateDisplay=true)
Add a dihedral angle restraint. 
void CrystUpdate(const bool updateUI=false, const bool mutexlock=false)
Forces all objects in the list to update. 
void AddAtom(const REAL x, const REAL y, const REAL z, const ScatteringPower *pPow, const string &name, const bool updateDisplay=true)
Add an atom. 
Abstract base class for all objects in wxCryst. 
The basic atom scatterer, in a crystal. 
REAL GetBondAngle(const MolAtom &at1, const MolAtom &at2, const MolAtom &at3)
Get The Bond Angle of 3 atoms. 
Molecule : class for complex scatterer descriptions using cartesian coordinates with bond length/angl...
Class for individual atoms in a ZScatterer Object. 
virtual void SetY(const REAL y)
Y coordinate (fractionnal) of the scatterer (for complex scatterers, this corresponds to the position...
REAL GetMax() const 
Get the maximum value allowed (if limited) 
Base class for all displayed ObjCryst objects (with a title, and a sizer to stack objects)...
MolAtom : atom inside a Molecule. 
const map< MolAtom *, set< MolAtom * > > & GetConnectivityTable()
Get the connectivity table. 
virtual void SetX(const REAL x)
X coordinate (fractionnal) of the scatterer (for complex scatterers, this corresponds to the position...
The base wxCryst class for all RefinableObj objects. 
long GetZBondAtom(const int i) const 
Index of the 1st atom used to define the i-th atom in the Z-Matrix (the one from which the bondlength...
ZScatterer: the basic type of complex scatterers, where atom positions are defined using a standard "...
const Crystal & GetCrystal() const 
In which crystal is this Scatterer included ? 
virtual void CrystUpdate(const bool updateUI=false, const bool mutexlock=false)
Get new values to be displayed from the underlying object, and raise flag if an UI update is necessar...
int GetAtomicNumber() const 
Atomic number for this atom. 
vector< MolBondAngle * >::const_iterator FindBondAngle(const MolAtom &at1, const MolAtom &at0, const MolAtom &at2) const 
Searches whether a bond between three atoms already exists, searching for either (at1,at2,at3) and (at3,at2,at1), as these are equivalent. 
Class to automatically assign a unique wxID to each window. 
The namespace which includes all objects (crystallographic and algorithmic) in ObjCryst++. 
The Scattering Power for an Atom. 
void BuildConnectivityTable() const 
Build the Connectivity table. 
Generic class for parameters of refinable objects. 
Molecule * ZScatterer2Molecule(ZScatterer *scatt)
Conversion from ZScatterer to the newer Molecule object. (in WXZScatterer.cpp) 
virtual const string & GetName() const 
Name of the object. 
REAL GetValue() const 
of the parameter. 
virtual void UpdateDisplay() const 
If there is an interface, this should be automatically be called each time there is a 'new...
virtual void UpdateUI(const bool mutexlock=false)
Update the User Interface, if necessary. 
const ObjRegistry< ZAtom > & GetZAtomRegistry() const 
Access to the registry of ZAtoms. 
long GetZDihedralAngleAtom(const int i) const 
Index of the 3rd atom used to define the i-th atom in the Z-Matrix (the one from which the dihedral a...
REAL GetZAtomX(const int i) const 
Get the X fractionnal coordinate of atom i. 
long GetZAngleAtom(const int i) const 
Index of the 2nd atom used to define the i-th atom in the Z-Matrix (the one from which the angle is c...
bool IsDummy() const 
Returns true if this is a dummy atom, i.e. 
void AddBond(MolAtom &atom1, MolAtom &atom2, const REAL length, const REAL sigma, const REAL delta, const REAL bondOrder=1., const bool updateDisplay=true)
Add a bond. 
virtual void SetZ(const REAL z)
Z coordinate (fractionnal) of the scatterer (for complex scatterers, this corresponds to the position...
void UpdateUI(const bool mutexlock=false)
Forces all objects in the list to update. 
base wxCryst class for Scatterers 
Abstract Base Class to describe the scattering power of any Scatterer component in a crystal...