Coder Social home page Coder Social logo

Comments (6)

jjgoings avatar jjgoings commented on June 8, 2024

I think you are correct, but I need to take a closer look! Happy to accept PR if you fix and add test, otherwise I'll get to it later.

from mcmurchie-davidson.

shaobin avatar shaobin commented on June 8, 2024

By your design, for the six indices t, u, v, tau, nu, phi (five for E and one for Ex), only the one for calling Ex should be with an additional +1, right? If nothing special for the (center == c, x == 2) and (center ==d, x == 2) cases, then I guess this might be a mistake.

After removing the +1 for both two lines, the existing code run smoothly. I've tested it in calculating forces. As the difference of the final results is negligible, I don't know how to well test the changes. Any thoughts?

from mcmurchie-davidson.

pwborthwick avatar pwborthwick commented on June 8, 2024

Hi,
Josh's test002.py has commented out a test of McMurchie-Davidson with force reference calculations done on Gaussian 16. (I think Josh commented it out simply because it took time to run). The test is for water and as you see the non-zero values compare as...
reference | mmd
...........................................................
0.097441437 | 0.0974414370 Oy
-0.086300098 | -0.0863000979 Hx
-0.048720718 | -0.0487207185 Hy
All good there!

Having said that I'm sure the extra '+1' in the loop conditions are a typo (could it be a cut-and-paste problem). I've 'corrected?' the code in my version of mmd and re-compiled the cython and it makes no difference at all to the printed accuracy of the results for this molecule. Unfortunately I couldn't make a direct comparison with my gradient implementation because I've parameterized the loop blocks reducing the 4x3 blocks to just one and a calling loop, but that enforces that there is only one doubly augmented loop in each block. I've had a quick look at Helgaker and couldn't see where the extra 1 might come from.

from mcmurchie-davidson.

shaobin avatar shaobin commented on June 8, 2024

@pwborthwick , I also think this should be a typo caused by cut-and-paste. After checking the code path, I think the extra '+1' does not do actual harm for the force calculation test case:

In the case r1z == 0, the last value of the index v is n1+n2+1. Calling E(int i,int j,int t,double Qx,double a,double b, int n, double Ax), which is defined in util.pyx, we will take the n == 0 and t > (i +j) code path (line 17 and 18). Zero will be returned. So the final value should be the same; but some CPU cycles are wasted in doing more loops.

from mcmurchie-davidson.

jjgoings avatar jjgoings commented on June 8, 2024

Thanks all. I agree this is a bug, but thankfully not one that affects the results. I've done multiple tests now and it seems to have no affect beyond performance.

from mcmurchie-davidson.

jjgoings avatar jjgoings commented on June 8, 2024

Fixed in 2f8b77d

from mcmurchie-davidson.

Related Issues (18)

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.