int main(void) {
	AskForInput();
  for (timestep = inistep; timestep <= finstep; timestep += intstep) {
		printf("timestep = %10d done\n",timestep);
		OpenHeAtomicFile();
	  BuildArrayClusters();
		ExtractHeliumCoordinate();
		BuildDistanceMatrix();
		PerformAnalysis();
		printf("\tcluster analysis done\n");
		PerformAgglomerateCluster();
		printf("\tcluster agglomerate, NCLUSTERS = %d done\n", NCLUSTERS);
		CalculateRadiusCluster();
		printf("\tcluster radius done\n");
		BinRadiusCluster();
		PrintRadiusCluster();
		PrintBinRadiusCluster();
//		PrintAtomLead();
		PrintCFGClusterCentreOfMass();
		PrintClusterPopulation();
		PrintCFGCluster();
		FreeMalloc();
	}
	return 0;
}
Ejemplo n.º 2
0
bool wxExViMacros::Playback(wxExEx* ex, const std::string& macro, int repeat)
{
  if (!IsRecordedMacro(macro))
  {
    wxLogStatus(_("Unknown macro") + ": "  +  macro);
    return false;
  }
  
  if (m_IsPlayback && macro == m_Macro)
  {
    wxLogStatus(_("Already playing back"));
    return false;
  }

  if (repeat <= 0)
  {
    return false;
  }
  
  ex->GetSTC()->BeginUndoAction();
  
  bool stop = false;
  
  if (!m_IsPlayback && !m_IsRecording)
  {
    m_Macro = macro;
    wxExFrame::StatusText(m_Macro, "PaneMacro");
  }
  
  m_IsPlayback = true;
  
  wxBusyCursor wait;
    
  AskForInput();
  
  const auto& macro_commands(m_Macros[macro]);
  
  for (int i = 0; i < repeat && !stop; i++)
  {
    for (auto& it : macro_commands)
    { 
      stop = !ex->Command(it);
      
      if (stop)
      {
        wxLogStatus(_("Macro aborted at '") + it + "'");
        break;
      }
    }
  }

  ex->GetSTC()->EndUndoAction();

  if (!stop)
  {
    wxLogStatus(_("Macro played back"));
    m_Macro = macro; // might be overridden by expanded variable
    wxExFrame::StatusText(m_Macro, "PaneMacro");
  }
  
  m_IsPlayback = false;
  
  return !stop;
}
Ejemplo n.º 3
0
bool wxExViMacros::ExpandTemplate(
  wxExEx* ex, const wxExVariable& v, std::string& expanded)
{
  if (v.GetValue().empty())
  {
    return false;
  }
  
  if (!m_IsExpand)
  {
    m_IsExpand = true;
    AskForInput();
  }

  // Read the file (file name is in v.GetValue()), expand
  // all macro variables in it, and set expanded.
  const wxExFileName filename(wxExConfigDir(), v.GetValue());

  std::ifstream ifs(filename.GetFullPath());
  
  if (!ifs.is_open())
  {
    wxLogError("Could not open template file: %s", filename.GetFullPath().c_str());
    return false;
  }

  // Keep current macro, in case you cancel expanding,
  // this one is restored.
  std::string macro = m_Macro;
  
  while (ifs.good() && !ifs.eof()) 
  {
    const char c = ifs.get();
    
    if (c != '@')
    {
      expanded += c;
    }
    else
    {
      std::string variable;
      bool completed = false;
      
      while (ifs.good() && !ifs.eof() && !completed) 
      {
        const char c = ifs.get();
    
        if (c != '@')
        {
          variable += c;
        }
        else
        {
          completed = true;
        }
      }
      
      if (!completed)
      {
        m_Macro = macro;
        return false;
      }
      
      // Prevent recursion.
      if (variable == v.GetName())
      {
        m_Macro = macro;
        return false;
      }
      
      std::string value;
      
      if (!Expand(ex, variable, value))
      {
        m_Macro = macro;
        return false;
      }
      
      expanded += value;
    }
  }
  
  m_IsExpand = false;

  // Set back to normal value.  
  AskForInput();
    
  if (!m_IsRecording)
  {
    m_Macro = v.GetName();
  }
    
  return true;
}
Ejemplo n.º 4
0
bool wxExViMacros::Playback(wxExEx* ex, const wxString& macro, int repeat)
{
  if (!IsRecordedMacro(macro))
  {
    wxLogStatus(_("Unknown macro") + ": "  +  macro);
    return false;
  }
  
  if (m_IsPlayback && macro == m_Macro)
  {
    wxLogStatus(_("Already playing back"));
    return false;
  }

  if (repeat <= 0)
  {
    return false;
  }
  
  ex->GetSTC()->BeginUndoAction();
  
  bool stop = false;
  
  if (!m_IsPlayback && !m_IsRecording)
  {
    m_Macro = macro;
    wxExFrame::StatusText(m_Macro, "PaneMacro");
  }
  
  m_IsPlayback = true;
  
  wxBusyCursor wait;
    
  AskForInput();
  
  for (int i = 0; i < repeat; i++)
  {
    for (
      std::vector<wxString>::const_iterator it = m_Macros[macro].begin();
      it != m_Macros[macro].end() && !stop;
      ++it)
    { 
      stop = !ex->Command(*it);
      
      if (stop)
      {
        wxLogStatus(_("Macro aborted at '") + *it + "'");
      }
    }
  }

  ex->GetSTC()->EndUndoAction();

  if (!stop)
  {
    wxLogStatus(_("Macro played back"));
  }
  
  m_IsPlayback = false;
  
  return !stop;
}
Ejemplo n.º 5
0
bool wxExViMacros::ExpandTemplate(
  wxExEx* ex, const wxExVariable& v, wxString& expanded)
{
  if (!m_IsExpand)
  {
    m_IsExpand = true;
    AskForInput();
  }

  // Read the file (file name is in m_Value), expand
  // all macro variables in it, and set expanded.
  const wxFileName filename(
#ifdef wxExUSE_PORTABLE
      wxPathOnly(wxStandardPaths::Get().GetExecutablePath())
#else
      wxStandardPaths::Get().GetUserDataDir()
#endif
      + wxFileName::GetPathSeparator() + v.GetValue());

  wxFileInputStream input(filename.GetFullPath());
  
  if (!input.IsOk())
  {
    wxLogError("Could not open template file: " + filename.GetFullPath());
    return false;
  }

  // Keep current macro, in case you cancel expanding,
  // this one is restored.
  wxString macro = m_Macro;
  
  wxTextInputStream text(input);
  
  while (input.IsOk() && !input.Eof()) 
  {
    const wxChar c = text.GetChar();
    
    if (c != '@')
    {
      expanded += c;
    }
    else
    {
      wxString variable;
      bool completed = false;
      
      while (input.IsOk() && !input.Eof() && !completed) 
      {
        const wxChar c = text.GetChar();
    
        if (c != '@')
        {
          variable += c;
        }
        else
        {
          completed = true;
        }
      }
      
      if (!completed)
      {
        m_Macro = macro;
        return false;
      }
      
      // Prevent recursion.
      if (variable == v.GetName())
      {
        m_Macro = macro;
        return false;
      }
      
      wxString value;
      
      if (!Expand(ex, variable, value))
      {
        m_Macro = macro;
        return false;
      }
      
      expanded += value;
    }
  }
  
  m_IsExpand = false;

  // Set back to normal value.  
  AskForInput();
    
  if (!m_IsRecording)
  {
    m_Macro = v.GetName();
  }
    
  return true;
}