Convert AMS Text Input or Run File to PLAMS Format
**************************************************

Technical

-[ Related examples ]-

* Composing AMS Input Blocks with PLAMS Settings

-[ Related tutorials ]-

* Python Getting Started tutorial

-[ Related documentation ]-

* AMS input and output overview

* PLAMS Settings


Convert AMS text input settings to what you would type in a PLAMS script
========================================================================

   inp = """
   Task GeometryOptimization

   GeometryOptimization
       MaxIterations 10000
       PretendConverged Yes
   End

   Engine ADF
       Basis
         Type DZP
       End
       XC
         GGA PBE
       End
       Solvation
         C-Mat Potential
         Charged Method=Conjugate-Gradient
         SCF Variational
         Solv Epsilon=78.4 Radius=1.4 Cav0=1.321 Cav1=0.0067639
         Surf Delley
       End
   EndEngine
   """

   from scm.utils.convert_run_to_plams import to_settings

   print(to_settings(inp, [], {}))

   s = Settings()
   s.input.ams.Task = 'GeometryOptimization'
   s.input.ADF = Settings()
   s.input.ADF.Basis.Type = 'DZP'
   s.input.ADF.Solvation["C-Mat"] = 'Potential'
   s.input.ADF.Solvation.Charged = 'Method=Conjugate-Gradient'
   s.input.ADF.Solvation.SCF = 'Variational'
   s.input.ADF.Solvation.Solv = 'Epsilon=78.4 Radius=1.4 Cav0=1.321 Cav1=0.0067639'
   s.input.ADF.Solvation.Surf = 'delley'
   s.input.ADF.XC.GGA = 'PBE'
   s.input.ams.GeometryOptimization.MaxIterations = '10000'
   s.input.ams.GeometryOptimization.PretendConverged = 'True'
   s.runscript.preamble_lines = []
   s.runscript.postamble_lines = []


Convert AMS text input settings to a Settings object
====================================================

   from scm.plams import AMSJob

   settings = AMSJob.from_input(inp).settings
   print(f"{type(settings)=}")
   print(settings)

   type(settings)=<class 'scm.plams.core.settings.Settings'>
   input:
         ADF:
             Basis:
                   Type:   DZP
             Solvation:
                       C-Mat:  Potential
                       Charged:    Method=Conjugate-Gradient
                       SCF:    Variational
                       Solv:   Epsilon=78.4 Radius=1.4 Cav0=1.321 Cav1=0.0067639
                       Surf:   delley
             XC:
                GGA:   PBE
         ams:
             Task:     GeometryOptimization
   on_status_change:   <empty Settings>


See also
========


Related examples
----------------

* Composing AMS Input Blocks with PLAMS Settings


Related tutorials
-----------------

* Python Getting Started tutorial


Related documentation
---------------------

* AMS input and output overview

* PLAMS Settings


Python Script
=============

   #!/usr/bin/env python
   # coding: utf-8

   # ## Convert AMS text input settings to what you would type in a PLAMS script

   inp = """
   Task GeometryOptimization

   GeometryOptimization
       MaxIterations 10000
       PretendConverged Yes
   End

   Engine ADF
       Basis
         Type DZP
       End
       XC
         GGA PBE
       End
       Solvation
         C-Mat Potential
         Charged Method=Conjugate-Gradient
         SCF Variational
         Solv Epsilon=78.4 Radius=1.4 Cav0=1.321 Cav1=0.0067639
         Surf Delley
       End
   EndEngine
   """


   from scm.utils.convert_run_to_plams import to_settings

   print(to_settings(inp, [], {}))


   # ## Convert AMS text input settings to a Settings object

   from scm.plams import AMSJob

   settings = AMSJob.from_input(inp).settings
   print(f"{type(settings)=}")
   print(settings)
