Giter Site home page Giter Site logo

CFOUR molden files about iodata HOT 4 CLOSED

shivupa avatar shivupa commented on August 17, 2024
CFOUR molden files

from iodata.

Comments (4)

amandadumi avatar amandadumi commented on August 17, 2024 2

@tovrstra thanks for orienting us and giving us some guidance, it's very helpful Your response has answered all of the questions we have at this point. We are familiar with python development with git and github, so this will be fine for us. We will open a WIP pull request and get started!

from iodata.

tovrstra avatar tovrstra commented on August 17, 2024 1

@shivupa Thanks for bringing this up. We'd love to update our code so it can handle CFOUR files. How familiar are you with changing the source code and making a pull request? We typically review PRs and make suggestions for code improvements until it all looks good. A good start is to create a PR with unit tests with CFOUR files, which just show that the current code fails. Then you can add commits to fix the problems. A technically detailed outline can be found here: https://github.com/theochem/iodata/blob/master/CONTRIBUTING.rst

I took a quick look at the molden file in the gist and this one is certainly useful for unit testing, i.e. it is not too big. It will take a bit of reverse engineering to find out the non-standard conventions that CFOUR Molden files use. By calculating and printing out the overlap matrix with IOData of the MO's for a small calculation, like you provide, you can detect where the issues are. This should obviously be an identity matrix, but this fails when there is a mismatch with the conventions. An example of such a test can found here:

@pytest.mark.parametrize("case", ["zn", "mn", "cuh"])
def test_load_molden_high_am_psi4(case):
# The file tested here is created with PSI4 1.3.2.
# This is a special case because it contains higher angular momenta than
# officially supported by the Molden format. Most virtual orbitals were removed.
with path('iodata.test.data', f'psi4_{case}_cc_pvqz_pure.molden') as fn_molden:
with pytest.warns(FileFormatWarning) as record:
mol = load_one(str(fn_molden))
assert len(record) == 1
assert "unnormalized" in record[0].message.args[0]
# Check normalization
olp = compute_overlap(mol.obasis, mol.atcoords)
if mol.mo.kind == "restricted":
check_orthonormal(mol.mo.coeffs, olp)
elif mol.mo.kind == "unrestricted":
check_orthonormal(mol.mo.coeffsa, olp)
check_orthonormal(mol.mo.coeffsb, olp)
else:
raise NotImplementedError

The function check_orthonormal does that test. Also the @pytest.mark.parametrize can be convenient to write a single test for multiple files.

The function with all the fixes for buggy molden files can be found here:

def _fix_molden_from_buggy_codes(result: dict, lit: LineIterator):

Depending on the type of issues in the Molden file, you may need to fix the sign convention, the ordering of the basis functions (within each shell) and/or their normalization. Non-standard signs and orderings can be defined in a conventions dictionary. Normalization must be fixed (for now) by rescaling the MO coefficients.

I'm not sure if this answer your question?

from iodata.

PaulWAyers avatar PaulWAyers commented on August 17, 2024

Thanks for pointing this out. @tovrstra is probably the best person to respond in detail. As you've surmised, molden files are darn tricky. Just off hand, however, I don't think it will be that difficult to support CFOUR molden files too.

from iodata.

shivupa avatar shivupa commented on August 17, 2024

Closed via #276

from iodata.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.