logsdail / carmm

Scripts for creation, manipulation and analysis of geometric and electronic structure of molecular models
GNU General Public License v3.0
5 stars 17 forks source link

Improved geodesic interpolate #172

Open GabrielBram opened 1 month ago

GabrielBram commented 1 month ago

Method for producing NEB pathways using the geodesic interpolation method of Zhu et al. [1]. Adapted to ASE objects, and operates with periodic boundary conditions and FixedAtom constraints of ASE. Compared to initial CARMM implementation, the current branch improves many functionalities, including evaluation speed for the path length and gradients, and actually evaluates the correct gradient expressions during optimization.

Example
-------
    from ase.io import read
    from carmm.build.neb.geodesic import GeodesicInterpolator
    from ase.constraints import FixAtoms
    from ase.mep import NEB

    # Example below produces a pathway with 6 interpolating images
    initial = read("initial.xyz")
    final = read("final.xyz")

    # If constraints are desired, specify as normal
    constraints = Fixatoms([0, 1])
    initial.set_constraints(constraints)
    final.set_constraints(constraints)

    # Interpolate images by iteratively generating images between the midpoint
    # images along the pathway
    geodesic = GeodesicInterpolator(initial, final, path_len=8)
    geodesic.init_path()

    # Smooth the pathway by performing a sweeping algorithm which reduces the
    # overall geodesic length of the pathway
    geodesic.sweep_iterative(sweeperiter=20)

    # Define the NEB pathway as normal
    neb = NEB(geodesic.images)
codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 91.53094% with 26 lines in your changes missing coverage. Please review.

Project coverage is 89.66%. Comparing base (08d248e) to head (a406448).

Files Patch % Lines
carmm/build/neb/geodesic.py 90.90% 20 Missing :warning:
carmm/build/adsorbate_placer_gui.py 0.00% 4 Missing :warning:
carmm/build/neb/geodesic_utils.py 97.01% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #172 +/- ## ========================================== + Coverage 89.38% 89.66% +0.27% ========================================== Files 82 85 +3 Lines 3382 3685 +303 ========================================== + Hits 3023 3304 +281 - Misses 359 381 +22 ``` | [Flag](https://app.codecov.io/gh/logsdail/carmm/pull/172/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Andrew+Logsdail) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/logsdail/carmm/pull/172/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Andrew+Logsdail) | `89.66% <91.53%> (+0.27%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Andrew+Logsdail#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

GabrielBram commented 1 month ago

Indeed, all commits from [0fa25c6]-[e8452a0] are part of the old branch.

GabrielBram commented 1 month ago

Just following up - once the new tests go through, can I have an approval for this PR (@robinsonmt1 @kush2803)?