{"id":170,"date":"2013-11-20T22:46:09","date_gmt":"2013-11-20T22:46:09","guid":{"rendered":"https:\/\/vallico.net\/casinoqmc\/?page_id=170"},"modified":"2026-10-11T02:39:14","modified_gmt":"2026-10-11T02:39:14","slug":"interface_development","status":"publish","type":"page","link":"https:\/\/vallico.net\/casinoqmc\/interface_development\/","title":{"rendered":"Write a CASINO interface to your code"},"content":{"rendered":"<p>For a real system of atoms, CASINO starts from orbitals computed by another program: Hartree\u2013Fock, density functional theory or a quantum-chemistry method. An interface carries those orbitals into CASINO. The <a href=\"https:\/\/vallico.net\/casinoqmc\/interfaces\/\">interfaces page<\/a> lists the programs that already have one. For someone who knows a program&#8217;s output, the converter itself can be a day or two&#8217;s work; the tests described below take longer, and they are what make it trustworthy.<\/p>\n<h5>What an interface writes<\/h5>\n<p>An interface writes the geometry, the basis, the occupations and the orbital coefficients into one of four files, chosen by the program&#8217;s basis:<\/p>\n<ul>\n<li><code>pwfn.data<\/code>, plane waves;<\/li>\n<li><code>bwfn.data<\/code>, blips, which CASINO&#8217;s <code>blip<\/code> utility makes from <code>pwfn.data<\/code>, so a plane-wave interface need not write blips itself;<\/li>\n<li><code>gwfn.data<\/code>, Gaussians;<\/li>\n<li><code>stowfn.data<\/code>, Slater-type orbitals.<\/li>\n<\/ul>\n<p>Orbitals tabulated on grids, for atoms and diatomic molecules, have formats of their own and are not covered here. The manual specifies every format, and the distribution&#8217;s <code>examples<\/code> directory holds complete files of each kind.<\/p>\n<p>There are two ways to write the file: change the program so that it writes the file itself, which is better because the interface then moves with the program, or write a converter, kept in <code>utils\/wfn_converters<\/code>, that reads the program&#8217;s output. Before writing either, see whether an existing route already serves. Many quantum-chemistry programs write MOLDEN files, which <code>molden2qmc<\/code> reads, and some write TREXIO files, which <code>trexio2qmc<\/code> reads.<\/p>\n<h5>Numbers<\/h5>\n<p>Write every significant digit. CASINO checks what it reads, the normalisation of the orbitals among other things, and coefficients rounded to a fixed format such as <code>f12.8<\/code> can fail those checks. In Fortran use a format such as <code>es24.16<\/code>; in Python write <code>repr()<\/code> of the float. Use the units the manual specifies for each file.<\/p>\n<h5>Plane waves and blips<\/h5>\n<p>The plane-wave interfaces in <code>utils\/wfn_converters<\/code>, for CASTEP, Quantum ESPRESSO, ABINIT and QBOX among others, are the best models. Coefficients are written as real numbers or, where they are complex, in the bracketed form <code>(re,im)<\/code> that the manual specifies. Writing the real and imaginary parts as two separate columns loses the imaginary part without any warning.<\/p>\n<p>Programs differ in which unoccupied orbitals they write (see question B10 of the FAQ). Say in your README what your interface writes.<\/p>\n<h5>Gaussians<\/h5>\n<ul>\n<li><strong>Angular momentum.<\/strong> CASINO evaluates Gaussian shells up to g in finite systems; in a periodic system it refuses spherical g shells. The manual&#8217;s specification of <code>gwfn.data<\/code> says what each kind of system accepts. Support the highest your program uses, within those limits.<\/li>\n<li><strong>Spherical or Cartesian.<\/strong> <code>gwfn.data<\/code> holds spherical (harmonic) shells or Cartesian d, f and g shells (shell codes \u22124, \u22125 and \u22126, in MOLDEN&#8217;s order, each normalised), which CASINO reads and evaluates itself, so a program that works in Cartesian functions no longer needs to transform them. The manual gives the ordering and normalisation of the components for both; the normalisation of real solid harmonics is easily confused, and <code>examples\/generic\/gauss_dfg<\/code> sets out the conventions CASINO uses. Say in your README which kind your converter writes, and make it refuse what it cannot convert rather than write something wrong.<\/li>\n<li><strong>MOLDEN files.<\/strong> <code>molden2qmc<\/code>, by Vladimir Konjkov and Mike Deible, reads the MOLDEN files of Molpro, TURBOMOLE, PSI4, Q-Chem, ORCA, NWChem, OpenMolcas, DALTON and PySCF. Each program writes its own dialect of the format, so a further program is best added as a new option of <code>molden2qmc<\/code> rather than as a new converter.<\/li>\n<li><strong>Pseudopotentials.<\/strong> Add 200 to the atomic number of each atom described by a pseudopotential. CASINO then expects the corresponding <code>x_pp.data<\/code> file and stops if it is missing, rather than treating the atom as all-electron.<\/li>\n<\/ul>\n<h5>The tests a Gaussian interface must pass<\/h5>\n<p>A new Gaussian interface comes with test cases for three methane-like molecules with d, f and g functions, called d-ane, f-ane and g-ane in <code>examples\/generic\/gauss_dfg<\/code>. Each holds the program&#8217;s input and output, the <code>gwfn.data<\/code> file, and the output of a CASINO VMC run with no Jastrow factor, whose energy must agree with the program&#8217;s Hartree\u2013Fock energy within its error bar; it is better still to check that the converted orbitals reproduce the program&#8217;s electron density. If your converter can write Cartesian shells, add cases that use them. Check a spin-polarised molecule and one with pseudopotentials as well. <code>gauss_dfg<\/code> already holds such cases for Molpro, TURBOMOLE, PSI4, ORCA, NWChem, OpenMolcas, DALTON and GAMESS, and is the model to follow. The regression suite does not run the converters, so these tests are the evidence that an interface works.<\/p>\n<h5>Slater-type orbitals<\/h5>\n<p>Slater-type orbitals come into CASINO from AMS\/ADF through <code>adf2stowf<\/code>, Vladimir Konjkov&#8217;s converter, distributed with CASINO in <code>utils\/wfn_converters\/adf<\/code>. It is the model for any new Slater interface, and the manual&#8217;s section on ADF explains the route.<\/p>\n<h5>Getting an interface into the distribution<\/h5>\n<p>A converter lives in its own directory under <code>utils\/wfn_converters<\/code>, with a README stating which versions of the program it was tested with, what it writes (the shells, spherical or Cartesian, restricted or unrestricted orbitals, pseudopotentials), what it refuses, and how to run it. Code taken from another program keeps its licence and its authors&#8217; names. The interface then reaches the repository by the same route as any other change, described in <a href=\"https:\/\/vallico.net\/casinoqmc\/how-to-become-a-developer\/\">Developing CASINO<\/a> and the <a href=\"https:\/\/vallico.net\/casinoqmc\/programming-guide\/\">programming guide<\/a>, and gains an entry on the interfaces page.<\/p>\n<h5>Thanks<\/h5>\n<p>CASINO&#8217;s interfaces have been written and kept working by many people over many years, most of them in the course of their own research, and their work is what makes CASINO usable with so many programs. Questions, corrections and offers of help are welcome on the <a href=\"https:\/\/vallico.net\/casinoqmc\/discussion-forum\/\">forum<\/a> or by email to Mike Towler (mdt26 at cantab.net).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For a real system of atoms, CASINO starts from orbitals computed by another program: Hartree\u2013Fock, density functional theory or a quantum-chemistry method. An interface carries those orbitals into CASINO. The interfaces page lists the programs that already have one. For someone who knows a program&#8217;s output, the converter itself can be a day or two&#8217;s &hellip; <a href=\"https:\/\/vallico.net\/casinoqmc\/interface_development\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Write a CASINO interface to your code<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","meta":{"footnotes":""},"class_list":["post-170","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Write a CASINO interface to your code - Quantum Monte Carlo<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/vallico.net\/casinoqmc\/interface_development\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Write a CASINO interface to your code - Quantum Monte Carlo\" \/>\n<meta property=\"og:description\" content=\"For a real system of atoms, CASINO starts from orbitals computed by another program: Hartree\u2013Fock, density functional theory or a quantum-chemistry method. An interface carries those orbitals into CASINO. The interfaces page lists the programs that already have one. For someone who knows a program&#8217;s output, the converter itself can be a day or two&#8217;s &hellip; Continue reading Write a CASINO interface to your code &rarr;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/vallico.net\/casinoqmc\/interface_development\/\" \/>\n<meta property=\"og:site_name\" content=\"Quantum Monte Carlo\" \/>\n<meta property=\"article:modified_time\" content=\"2026-10-11T02:39:14+00:00\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/vallico.net\\\/casinoqmc\\\/interface_development\\\/\",\"url\":\"https:\\\/\\\/vallico.net\\\/casinoqmc\\\/interface_development\\\/\",\"name\":\"Write a CASINO interface to your code - Quantum Monte Carlo\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/vallico.net\\\/casinoqmc\\\/#website\"},\"datePublished\":\"2013-11-20T22:46:09+00:00\",\"dateModified\":\"2026-10-11T02:39:14+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/vallico.net\\\/casinoqmc\\\/interface_development\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/vallico.net\\\/casinoqmc\\\/interface_development\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/vallico.net\\\/casinoqmc\\\/interface_development\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/vallico.net\\\/casinoqmc\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Write a CASINO interface to your code\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/vallico.net\\\/casinoqmc\\\/#website\",\"url\":\"https:\\\/\\\/vallico.net\\\/casinoqmc\\\/\",\"name\":\"Quantum Monte Carlo\",\"description\":\"and the CASINO program\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/vallico.net\\\/casinoqmc\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Write a CASINO interface to your code - Quantum Monte Carlo","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/vallico.net\/casinoqmc\/interface_development\/","og_locale":"en_US","og_type":"article","og_title":"Write a CASINO interface to your code - Quantum Monte Carlo","og_description":"For a real system of atoms, CASINO starts from orbitals computed by another program: Hartree\u2013Fock, density functional theory or a quantum-chemistry method. An interface carries those orbitals into CASINO. The interfaces page lists the programs that already have one. For someone who knows a program&#8217;s output, the converter itself can be a day or two&#8217;s &hellip; Continue reading Write a CASINO interface to your code &rarr;","og_url":"https:\/\/vallico.net\/casinoqmc\/interface_development\/","og_site_name":"Quantum Monte Carlo","article_modified_time":"2026-10-11T02:39:14+00:00","twitter_misc":{"Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/vallico.net\/casinoqmc\/interface_development\/","url":"https:\/\/vallico.net\/casinoqmc\/interface_development\/","name":"Write a CASINO interface to your code - Quantum Monte Carlo","isPartOf":{"@id":"https:\/\/vallico.net\/casinoqmc\/#website"},"datePublished":"2013-11-20T22:46:09+00:00","dateModified":"2026-10-11T02:39:14+00:00","breadcrumb":{"@id":"https:\/\/vallico.net\/casinoqmc\/interface_development\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/vallico.net\/casinoqmc\/interface_development\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/vallico.net\/casinoqmc\/interface_development\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/vallico.net\/casinoqmc\/"},{"@type":"ListItem","position":2,"name":"Write a CASINO interface to your code"}]},{"@type":"WebSite","@id":"https:\/\/vallico.net\/casinoqmc\/#website","url":"https:\/\/vallico.net\/casinoqmc\/","name":"Quantum Monte Carlo","description":"and the CASINO program","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/vallico.net\/casinoqmc\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"jetpack_sharing_enabled":true,"jetpack_likes_enabled":false,"_links":{"self":[{"href":"https:\/\/vallico.net\/casinoqmc\/wp-json\/wp\/v2\/pages\/170","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vallico.net\/casinoqmc\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/vallico.net\/casinoqmc\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/vallico.net\/casinoqmc\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vallico.net\/casinoqmc\/wp-json\/wp\/v2\/comments?post=170"}],"version-history":[{"count":4,"href":"https:\/\/vallico.net\/casinoqmc\/wp-json\/wp\/v2\/pages\/170\/revisions"}],"predecessor-version":[{"id":10878,"href":"https:\/\/vallico.net\/casinoqmc\/wp-json\/wp\/v2\/pages\/170\/revisions\/10878"}],"wp:attachment":[{"href":"https:\/\/vallico.net\/casinoqmc\/wp-json\/wp\/v2\/media?parent=170"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}