Example script stopped working

Issue #219 new
andrew_peterson repo owner created an issue

The example script with force training (e.g., here), is not converging as of the latest development version.

I tried it with 0.6.0 and it works fine, converging in about 300 steps. Things to check:

  • Scipy version (Amp 0.6.0 test used 0.19.1 with python2, which is the slow one; newer Amp tests used Scipy v1.1.0 with python3)
  • Default Gaussian fingerprint parameters have changed.
  • Anything else?

Comments (1)

  1. Muammar El Khatib

    It worked for me, using the script you mentioned. Attached you have the -log.txt using the plot-convergence tool.

    """Simple test of the Amp calculator, using Gaussian descriptors and neural
    network model. Randomly generates data with the EMT potential in MD
    simulations."""
    
    import os
    from ase import Atoms, Atom, units
    import ase.io
    from ase.calculators.emt import EMT
    from ase.lattice.surface import fcc110
    from ase.md.velocitydistribution import MaxwellBoltzmannDistribution
    from ase.md import VelocityVerlet
    from ase.constraints import FixAtoms
    
    from amp import Amp
    from amp.descriptor.gaussian import Gaussian
    from amp.model.neuralnetwork import NeuralNetwork
    from amp.model import LossFunction
    
    
    def generate_data(count, filename='training.traj'):
        """Generates test or training data with a simple MD simulation."""
        if os.path.exists(filename):
            return
        traj = ase.io.Trajectory(filename, 'w')
        atoms = fcc110('Pt', (2, 2, 2), vacuum=7.)
        atoms.extend(Atoms([Atom('Cu', atoms[7].position + (0., 0., 2.5)),
                            Atom('Cu', atoms[7].position + (0., 0., 5.))]))
        atoms.set_constraint(FixAtoms(indices=[0, 2]))
        atoms.set_calculator(EMT())
        atoms.get_potential_energy()
        traj.write(atoms)
        MaxwellBoltzmannDistribution(atoms, 300. * units.kB)
        dyn = VelocityVerlet(atoms, dt=1. * units.fs)
        for step in range(count - 1):
            dyn.run(50)
            traj.write(atoms)
    
    
    generate_data(20)
    
    calc = Amp(descriptor=Gaussian(),
               model=NeuralNetwork(hiddenlayers=(10, 10, 10)))
    calc.model.lossfunction = LossFunction(convergence={'energy_rmse': 0.02,
                                                        'force_rmse': 0.02})
    calc.train(images='training.traj')
    
     5762 2018-08-15T14:09:46   3.2073e-04 5.4964e-05 C 1.3865e-04 C 2.0021e-02 - 1.3935e-01 C
     5763 2018-08-15T14:09:46   3.2056e-04 5.1715e-05 C 1.3805e-04 C 2.0016e-02 - 1.3936e-01 C
     5764 2018-08-15T14:09:46   3.2039e-04 5.2613e-05 C 1.3609e-04 C 2.0011e-02 - 1.3896e-01 C
     5765 2018-08-15T14:09:46   3.2025e-04 5.3339e-05 C 1.2897e-04 C 2.0006e-02 - 1.3876e-01 C
     5766 2018-08-15T14:09:46   3.2011e-04 5.1133e-05 C 1.2265e-04 C 2.0002e-02 - 1.3898e-01 C
     5767 2018-08-15T14:09:47   3.1997e-04 5.2586e-05 C 1.3098e-04 C 1.9997e-02 C 1.3936e-01 C
    ...optimization successful. 17.9 min.
    Amp successfully trained. Saving current parameters.
    Parameters saved in file "amp.amp".
    This file can be opened with `calc = Amp.load('amp.amp')`
    

    This is my OS info:

    User: muammar
    Hostname: nuc
    Date: 2018-08-15T13:51:38 (2018-08-15T17:51:38 UTC)
    Architecture: x86_64
    PID: 29787
    Amp version: 0.7.0-beta
    Amp directory: /home/muammar/brown/git/amp/amp
     Last commit: 82d1a78ff265a8fc7446a6f259a2a28e0b97bca9
     Last commit date: 2018-08-14 14:50:35 +0000
    Python: v3.6.6: /usr/bin/python3
    ASE v3.16.3b1: /home/muammar/brown/git/ase/ase
    NumPy v1.15.0: /home/muammar/.local/lib/python3.6/site-packages/numpy
    SciPy v1.1.0: /home/muammar/.local/lib/python3.6/site-packages/scipy
    ZMQ/PyZMQ v4.1.6/v17.0.0: /home/muammar/.local/lib/python3.6/site-packages/zmq
    pxssh: Not available from pxssh.
    pxssh (via pexpect v4.6.0): /home/muammar/.local/lib/python3.6/site-packages/pexpect/pxssh.py
    

    convergence.png

  2. Log in to comment